diff options
| author | christos <christos@NetBSD.org> | 2008-04-05 20:17:37 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2008-04-05 20:17:37 +0000 |
| commit | 8a487dca063cec630d2e07cfa9cbeb0d530be748 (patch) | |
| tree | 3b0ac91485c7c68053d435da98d4ff6303a0a6f2 /libexec | |
| parent | 801bd3ddec671aca35940b1cd5ed6f81c85de9fc (diff) | |
Fix build from dieter roelants
Diffstat (limited to 'libexec')
| -rw-r--r-- | libexec/atrun/atrun.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/libexec/atrun/atrun.c b/libexec/atrun/atrun.c index fb2ab0b026f..dc2e31cf41e 100644 --- a/libexec/atrun/atrun.c +++ b/libexec/atrun/atrun.c @@ -1,4 +1,4 @@ -/* $NetBSD: atrun.c,v 1.18 2007/12/15 19:44:45 perry Exp $ */ +/* $NetBSD: atrun.c,v 1.19 2008/04/05 20:17:37 christos Exp $ */ /* * atrun.c - run jobs queued by at; run with root privileges. @@ -59,7 +59,7 @@ #if 0 static char rcsid[] = "$OpenBSD: atrun.c,v 1.7 1997/09/08 22:12:10 millert Exp $"; #else -__RCSID("$NetBSD: atrun.c,v 1.18 2007/12/15 19:44:45 perry Exp $"); +__RCSID("$NetBSD: atrun.c,v 1.19 2008/04/05 20:17:37 christos Exp $"); #endif static int debug = 0; @@ -160,12 +160,12 @@ run_file(const char *filename, uid_t uid, gid_t gid) gid_t ngid; int serrno; - PRIV_START + PRIV_START; if (chmod(filename, S_IRUSR) == -1) perr("Cannot change file permissions to `%s'", filename); - PRIV_END + PRIV_END; pid = fork(); if (pid == -1) @@ -184,12 +184,12 @@ run_file(const char *filename, uid_t uid, gid_t gid) perrx("Userid %lu not found - aborting job `%s'", (unsigned long)uid, filename); - PRIV_START + PRIV_START; stream = fopen(filename, "r"); serrno = errno; - PRIV_END + PRIV_END; if (stream == NULL) { errno = serrno; @@ -206,12 +206,12 @@ run_file(const char *filename, uid_t uid, gid_t gid) if (fstat(fd_in, &buf) == -1) perr("Error in fstat of input file descriptor"); - PRIV_START + PRIV_START; if (lstat(filename, &lbuf) == -1) perr("Error in lstat of `%s'", filename); - PRIV_END + PRIV_END; if (S_ISLNK(lbuf.st_mode)) perrx("Symbolic link encountered in job `%s' - aborting", @@ -253,7 +253,7 @@ run_file(const char *filename, uid_t uid, gid_t gid) (void)fclose(stream); - PRIV_START + PRIV_START; if (chdir(_PATH_ATSPOOL) == -1) perr("Cannot chdir to `%s'", _PATH_ATSPOOL); @@ -267,7 +267,7 @@ run_file(const char *filename, uid_t uid, gid_t gid) O_WRONLY | O_CREAT | O_EXCL, S_IWUSR | S_IRUSR)) == -1) perr("Cannot create output file `%s'", filename); - PRIV_END + PRIV_END; write_string(fd_out, "To: "); write_string(fd_out, mailname); @@ -309,7 +309,7 @@ run_file(const char *filename, uid_t uid, gid_t gid) (void)close(fd_in); (void)close(fd_out); - PRIV_START + PRIV_START; if (chdir(_PATH_ATJOBS) == -1) perr("Cannot chdir to `%s'", _PATH_ATJOBS); @@ -333,7 +333,7 @@ run_file(const char *filename, uid_t uid, gid_t gid) * Send mail. Unlink the output file first, so it is deleted * after the run. */ - PRIV_START + PRIV_START; if (stat(filename, &buf) == -1) perr("Error in stat of output file `%s'", filename); @@ -342,12 +342,12 @@ run_file(const char *filename, uid_t uid, gid_t gid) (void)unlink(filename); - PRIV_END + PRIV_END; if ((buf.st_size != size) || send_mail) { /* Fork off a child for sending mail */ - PRIV_START + PRIV_START; become_user(pentry, uid); @@ -355,7 +355,7 @@ run_file(const char *filename, uid_t uid, gid_t gid) "-odi", "-oem", "-t", (char *) NULL); perr("Exec failed for mail command `%s'", _PATH_SENDMAIL); - PRIV_END + PRIV_END; } exit(EXIT_SUCCESS); } @@ -406,7 +406,7 @@ main(int argc, char *argv[]) * We don't need root privileges all the time; running under uid * and gid nobody is fine except for privileged operations. */ - RELINQUISH_PRIVS_ROOT(pwd->pw_uid, grp->gr_gid) + RELINQUISH_PRIVS_ROOT(pwd->pw_uid, grp->gr_gid); opterr = 0; errno = 0; @@ -433,7 +433,7 @@ main(int argc, char *argv[]) } } - PRIV_START + PRIV_START; if (chdir(_PATH_ATJOBS) == -1) perr("Cannot change directory to `%s'", _PATH_ATJOBS); @@ -453,7 +453,7 @@ main(int argc, char *argv[]) if ((spool = opendir(".")) == NULL) perr("Cannot open `%s'", _PATH_ATJOBS); - PRIV_END + PRIV_END; now = time(NULL); run_batch = 0; @@ -461,13 +461,13 @@ main(int argc, char *argv[]) batch_gid = (gid_t) -1; while ((dirent = readdir(spool)) != NULL) { - PRIV_START + PRIV_START; if (stat(dirent->d_name, &buf) == -1) perr("Cannot stat `%s' in `%s'", dirent->d_name, _PATH_ATJOBS); - PRIV_END + PRIV_END; /* We don't want directories */ if (!S_ISREG(buf.st_mode)) @@ -498,11 +498,11 @@ main(int argc, char *argv[]) /* Delete older files */ if ((run_time < now) && !(S_IXUSR & buf.st_mode) && (S_IRUSR & buf.st_mode)) { - PRIV_START + PRIV_START; (void)unlink(dirent->d_name); - PRIV_END + PRIV_END; } } |
