diff options
Diffstat (limited to 'usr.sbin/cron/crontab.c')
-rw-r--r-- | usr.sbin/cron/crontab.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/usr.sbin/cron/crontab.c b/usr.sbin/cron/crontab.c index ed53b581e27..d0993d3e1a2 100644 --- a/usr.sbin/cron/crontab.c +++ b/usr.sbin/cron/crontab.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crontab.c,v 1.63 2011/08/19 20:53:36 millert Exp $ */ +/* $OpenBSD: crontab.c,v 1.64 2011/08/22 19:32:42 millert Exp $ */ /* Copyright 1988,1990,1993,1994 by Paul Vixie * All rights reserved @@ -70,7 +70,7 @@ usage(const char *msg) { "\t-e\t(edit user's crontab)\n" "\t-l\t(list user's crontab)\n" "\t-r\t(delete user's crontab)\n"); - exit(ERROR_EXIT); + exit(EXIT_FAILURE); } int @@ -93,9 +93,9 @@ main(int argc, char *argv[]) { User, ProgramName); fprintf(stderr, "See crontab(1) for more information\n"); log_it(RealUser, Pid, "AUTH", "crontab command not allowed"); - exit(ERROR_EXIT); + exit(EXIT_FAILURE); } - exitstatus = OK_EXIT; + exitstatus = EXIT_SUCCESS; switch (Option) { case opt_list: list_cmd(); @@ -108,10 +108,10 @@ main(int argc, char *argv[]) { break; case opt_replace: if (replace_cmd() < 0) - exitstatus = ERROR_EXIT; + exitstatus = EXIT_FAILURE; break; default: - exitstatus = ERROR_EXIT; + exitstatus = EXIT_FAILURE; break; } exit(exitstatus); @@ -126,11 +126,11 @@ parse_args(int argc, char *argv[]) { fprintf(stderr, "%s: your UID isn't in the passwd file.\n", ProgramName); fprintf(stderr, "bailing out.\n"); - exit(ERROR_EXIT); + exit(EXIT_FAILURE); } if (strlen(pw->pw_name) >= sizeof User) { fprintf(stderr, "username too long\n"); - exit(ERROR_EXIT); + exit(EXIT_FAILURE); } strlcpy(User, pw->pw_name, sizeof(User)); strlcpy(RealUser, User, sizeof(RealUser)); @@ -148,12 +148,12 @@ parse_args(int argc, char *argv[]) { if (MY_UID(pw) != ROOT_UID) { fprintf(stderr, "must be privileged to use -u\n"); - exit(ERROR_EXIT); + exit(EXIT_FAILURE); } if (!(pw = getpwnam(optarg))) { fprintf(stderr, "%s: user `%s' unknown\n", ProgramName, optarg); - exit(ERROR_EXIT); + exit(EXIT_FAILURE); } if (strlcpy(User, optarg, sizeof User) >= sizeof User) usage("username too long"); @@ -211,15 +211,15 @@ parse_args(int argc, char *argv[]) { if (swap_gids() < OK) { perror("swapping gids"); - exit(ERROR_EXIT); + exit(EXIT_FAILURE); } if (!(NewCrontab = fopen(Filename, "r"))) { perror(Filename); - exit(ERROR_EXIT); + exit(EXIT_FAILURE); } if (swap_gids_back() < OK) { perror("swapping gids back"); - exit(ERROR_EXIT); + exit(EXIT_FAILURE); } } } @@ -236,14 +236,14 @@ list_cmd(void) { log_it(RealUser, Pid, "LIST", User); if (snprintf(n, sizeof n, "%s/%s", SPOOL_DIR, User) >= sizeof(n)) { fprintf(stderr, "path too long\n"); - exit(ERROR_EXIT); + exit(EXIT_FAILURE); } if (!(f = fopen(n, "r"))) { if (errno == ENOENT) fprintf(stderr, "no crontab for %s\n", User); else perror(n); - exit(ERROR_EXIT); + exit(EXIT_FAILURE); } /* file is open. copy to stdout, close. @@ -261,14 +261,14 @@ delete_cmd(void) { log_it(RealUser, Pid, "DELETE", User); if (snprintf(n, sizeof n, "%s/%s", SPOOL_DIR, User) >= sizeof(n)) { fprintf(stderr, "path too long\n"); - exit(ERROR_EXIT); + exit(EXIT_FAILURE); } if (unlink(n) != 0) { if (errno == ENOENT) fprintf(stderr, "no crontab for %s\n", User); else perror(n); - exit(ERROR_EXIT); + exit(EXIT_FAILURE); } poke_daemon(SPOOL_DIR, RELOAD_CRON); } @@ -291,18 +291,18 @@ edit_cmd(void) { log_it(RealUser, Pid, "BEGIN EDIT", User); if (snprintf(n, sizeof n, "%s/%s", SPOOL_DIR, User) >= sizeof(n)) { fprintf(stderr, "path too long\n"); - exit(ERROR_EXIT); + exit(EXIT_FAILURE); } if (!(f = fopen(n, "r"))) { if (errno != ENOENT) { perror(n); - exit(ERROR_EXIT); + exit(EXIT_FAILURE); } fprintf(stderr, "no crontab for %s - using an empty one\n", User); if (!(f = fopen(_PATH_DEVNULL, "r"))) { perror(_PATH_DEVNULL); - exit(ERROR_EXIT); + exit(EXIT_FAILURE); } } @@ -330,12 +330,12 @@ edit_cmd(void) { } if (swap_gids() < OK) { perror("swapping gids"); - exit(ERROR_EXIT); + exit(EXIT_FAILURE); } t = mkstemp(Filename); if (swap_gids_back() < OK) { perror("swapping gids back"); - exit(ERROR_EXIT); + exit(EXIT_FAILURE); } if (t == -1) { perror(Filename); @@ -352,7 +352,7 @@ edit_cmd(void) { fclose(f); if (fflush(NewCrontab) < OK) { perror(Filename); - exit(ERROR_EXIT); + exit(EXIT_FAILURE); } (void)futimens(t, ts); again: @@ -363,14 +363,14 @@ edit_cmd(void) { fatal: if (swap_gids() < OK) { perror("swapping gids"); - exit(ERROR_EXIT); + exit(EXIT_FAILURE); } unlink(Filename); if (swap_gids_back() < OK) { perror("swapping gids back"); - exit(ERROR_EXIT); + exit(EXIT_FAILURE); } - exit(ERROR_EXIT); + exit(EXIT_FAILURE); } /* we still have the file open. editors will generally rewrite the @@ -392,7 +392,7 @@ edit_cmd(void) { if (timespeccmp(&ts[1], &statbuf.st_mtim, ==)) { if (swap_gids() < OK) { perror("swapping gids"); - exit(ERROR_EXIT); + exit(EXIT_FAILURE); } if (lstat(Filename, &xstatbuf) == 0 && statbuf.st_ino != xstatbuf.st_ino) { @@ -401,7 +401,7 @@ edit_cmd(void) { } if (swap_gids_back() < OK) { perror("swapping gids back"); - exit(ERROR_EXIT); + exit(EXIT_FAILURE); } fprintf(stderr, "%s: no changes made to crontab\n", ProgramName); @@ -445,12 +445,12 @@ edit_cmd(void) { remove: if (swap_gids() < OK) { perror("swapping gids"); - exit(ERROR_EXIT); + exit(EXIT_FAILURE); } unlink(Filename); if (swap_gids_back() < OK) { perror("swapping gids back"); - exit(ERROR_EXIT); + exit(EXIT_FAILURE); } done: log_it(RealUser, Pid, "END EDIT", User); @@ -663,7 +663,7 @@ static void die(int x) { if (TempFilename[0]) (void) unlink(TempFilename); - _exit(ERROR_EXIT); + _exit(EXIT_FAILURE); } static void |