diff options
| author | Kyle Evans <kevans@FreeBSD.org> | 2020-02-10 02:40:23 +0000 |
|---|---|---|
| committer | Kyle Evans <kevans@FreeBSD.org> | 2020-02-10 02:40:23 +0000 |
| commit | 9b36723388048ad6c120166fbc200bc16eb6a001 (patch) | |
| tree | e2787d574a5017d29c4ddc35e796dfa1d4bf6637 /usr.sbin/cron | |
| parent | 9ce150463c33f422448febf56647a4370c7644c7 (diff) | |
Notes
Diffstat (limited to 'usr.sbin/cron')
| -rw-r--r-- | usr.sbin/cron/cron/compat.h | 4 | ||||
| -rw-r--r-- | usr.sbin/cron/cron/do_command.c | 17 | ||||
| -rw-r--r-- | usr.sbin/cron/cron/externs.h | 4 | ||||
| -rw-r--r-- | usr.sbin/cron/cron/popen.c | 2 | ||||
| -rw-r--r-- | usr.sbin/cron/lib/compat.c | 12 |
5 files changed, 8 insertions, 31 deletions
diff --git a/usr.sbin/cron/cron/compat.h b/usr.sbin/cron/cron/compat.h index 905c3aaf3bd9..ba32a31b417e 100644 --- a/usr.sbin/cron/cron/compat.h +++ b/usr.sbin/cron/cron/compat.h @@ -76,10 +76,6 @@ /*****************************************************************/ -#if !defined(BSD) && !defined(HPUX) && !defined(CONVEX) && !defined(__linux) -# define NEED_VFORK -#endif - #if (!defined(BSD) || (BSD < 198902)) && !defined(__linux) && \ !defined(IRIX) && !defined(NeXT) && !defined(HPUX) # define NEED_STRCASECMP diff --git a/usr.sbin/cron/cron/do_command.c b/usr.sbin/cron/cron/do_command.c index 375f55caf7c0..8d759dda031b 100644 --- a/usr.sbin/cron/cron/do_command.c +++ b/usr.sbin/cron/cron/do_command.c @@ -58,9 +58,6 @@ do_command(e, u) /* fork to become asynchronous -- parent process is done immediately, * and continues to run the normal cron code, which means return to * tick(). the child and grandchild don't leave this function, alive. - * - * vfork() is unsuitable, since we have much to do, and the parent - * needs to be able to run off and fork other processes. */ switch ((pid = fork())) { case -1: @@ -222,13 +219,13 @@ child_process(e, u) /* fork again, this time so we can exec the user's command. */ - switch (jobpid = vfork()) { + switch (jobpid = fork()) { case -1: - log_it("CRON",getpid(),"error","can't vfork"); + log_it("CRON",getpid(),"error","can't fork"); exit(ERROR_EXIT); /*NOTREACHED*/ case 0: - Debug(DPROC, ("[%d] grandchild process Vfork()'ed\n", + Debug(DPROC, ("[%d] grandchild process fork()'ed\n", getpid())) if (e->uid == ROOT_UID) @@ -315,24 +312,24 @@ child_process(e, u) if (setgid(e->gid) != 0) { log_it(usernm, getpid(), "error", "setgid failed"); - exit(ERROR_EXIT); + _exit(ERROR_EXIT); } # if defined(BSD) if (initgroups(usernm, e->gid) != 0) { log_it(usernm, getpid(), "error", "initgroups failed"); - exit(ERROR_EXIT); + _exit(ERROR_EXIT); } # endif if (setlogin(usernm) != 0) { log_it(usernm, getpid(), "error", "setlogin failed"); - exit(ERROR_EXIT); + _exit(ERROR_EXIT); } if (setuid(e->uid) != 0) { log_it(usernm, getpid(), "error", "setuid failed"); - exit(ERROR_EXIT); + _exit(ERROR_EXIT); } /* we aren't root after this..*/ #if defined(LOGIN_CAP) diff --git a/usr.sbin/cron/cron/externs.h b/usr.sbin/cron/cron/externs.h index 64bc8aceeb3a..8b1ff71b36e2 100644 --- a/usr.sbin/cron/cron/externs.h +++ b/usr.sbin/cron/cron/externs.h @@ -141,7 +141,3 @@ extern int getdtablesize(void); #ifdef NEED_SETENV extern int setenv(char *, char *, int); #endif - -#ifdef NEED_VFORK -extern PID_T vfork(void); -#endif diff --git a/usr.sbin/cron/cron/popen.c b/usr.sbin/cron/cron/popen.c index 73e6e28d748a..44aaa0c990f6 100644 --- a/usr.sbin/cron/cron/popen.c +++ b/usr.sbin/cron/cron/popen.c @@ -112,7 +112,7 @@ cron_popen(program, type, e, pidptr) #endif iop = NULL; - switch(pid = vfork()) { + switch(pid = fork()) { case -1: /* error */ (void)close(pdes[0]); (void)close(pdes[1]); diff --git a/usr.sbin/cron/lib/compat.c b/usr.sbin/cron/lib/compat.c index 96860128882f..3cdbae920d47 100644 --- a/usr.sbin/cron/lib/compat.c +++ b/usr.sbin/cron/lib/compat.c @@ -35,18 +35,6 @@ static char rcsid[] = "$FreeBSD$"; #include <paths.h> -/* the code does not depend on any of vfork's - * side-effects; it just uses it as a quick - * fork-and-exec. - */ -#ifdef NEED_VFORK -PID_T -vfork() { - return (fork()); -} -#endif - - #ifdef NEED_STRDUP char * strdup(str) |
