popen.c (62376) | popen.c (69793) |
---|---|
1/* 2 * Copyright (c) 1988 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software written by Ken Arnold and 6 * published in UNIX Review, Vol. 6, No. 8. 7 * 8 * Redistribution and use in source and binary forms are permitted --- 14 unchanged lines hidden (view full) --- 23 * globbing stuff since we don't need it. also execvp instead of execv. 24 */ 25 26#ifndef lint 27#if 0 28static char sccsid[] = "@(#)popen.c 5.7 (Berkeley) 2/14/89"; 29#endif 30static const char rcsid[] = | 1/* 2 * Copyright (c) 1988 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software written by Ken Arnold and 6 * published in UNIX Review, Vol. 6, No. 8. 7 * 8 * Redistribution and use in source and binary forms are permitted --- 14 unchanged lines hidden (view full) --- 23 * globbing stuff since we don't need it. also execvp instead of execv. 24 */ 25 26#ifndef lint 27#if 0 28static char sccsid[] = "@(#)popen.c 5.7 (Berkeley) 2/14/89"; 29#endif 30static const char rcsid[] = |
31 "$FreeBSD: head/usr.sbin/cron/cron/popen.c 62376 2000-07-02 04:15:15Z ache $"; | 31 "$FreeBSD: head/usr.sbin/cron/cron/popen.c 69793 2000-12-09 09:35:55Z obrien $"; |
32#endif /* not lint */ 33 34#include "cron.h" 35#include <sys/signal.h> 36#include <fcntl.h> | 32#endif /* not lint */ 33 34#include "cron.h" 35#include <sys/signal.h> 36#include <fcntl.h> |
37#include <paths.h> |
|
37#if defined(SYSLOG) 38# include <syslog.h> 39#endif 40#if defined(LOGIN_CAP) 41# include <login_cap.h> 42#endif 43 44 --- 80 unchanged lines hidden (view full) --- 125 126 /* get new pgrp, void tty, etc. 127 */ 128 (void) setsid(); 129 } 130 if (*type == 'r') { 131 /* Do not share our parent's stdin */ 132 (void)close(0); | 38#if defined(SYSLOG) 39# include <syslog.h> 40#endif 41#if defined(LOGIN_CAP) 42# include <login_cap.h> 43#endif 44 45 --- 80 unchanged lines hidden (view full) --- 126 127 /* get new pgrp, void tty, etc. 128 */ 129 (void) setsid(); 130 } 131 if (*type == 'r') { 132 /* Do not share our parent's stdin */ 133 (void)close(0); |
133 (void)open("/dev/null", O_RDWR); | 134 (void)open(_PATH_DEVNULL, O_RDWR); |
134 if (pdes[1] != 1) { 135 dup2(pdes[1], 1); 136 dup2(pdes[1], 2); /* stderr, too! */ 137 (void)close(pdes[1]); 138 } 139 (void)close(pdes[0]); 140 } else { 141 if (pdes[0] != 0) { 142 dup2(pdes[0], 0); 143 (void)close(pdes[0]); 144 } 145 /* Hack: stdout gets revoked */ 146 (void)close(1); | 135 if (pdes[1] != 1) { 136 dup2(pdes[1], 1); 137 dup2(pdes[1], 2); /* stderr, too! */ 138 (void)close(pdes[1]); 139 } 140 (void)close(pdes[0]); 141 } else { 142 if (pdes[0] != 0) { 143 dup2(pdes[0], 0); 144 (void)close(pdes[0]); 145 } 146 /* Hack: stdout gets revoked */ 147 (void)close(1); |
147 (void)open("/dev/null", O_RDWR); | 148 (void)open(_PATH_DEVNULL, O_RDWR); |
148 (void)close(2); | 149 (void)close(2); |
149 (void)open("/dev/null", O_RDWR); | 150 (void)open(_PATH_DEVNULL, O_RDWR); |
150 (void)close(pdes[1]); 151 } 152# if defined(LOGIN_CAP) 153 if (e != NULL) { 154 /* Set user's entire context, but skip the environment 155 * as cron provides a separate interface for this 156 */ 157 usernm = env_get("LOGNAME", e->envp); --- 82 unchanged lines hidden --- | 151 (void)close(pdes[1]); 152 } 153# if defined(LOGIN_CAP) 154 if (e != NULL) { 155 /* Set user's entire context, but skip the environment 156 * as cron provides a separate interface for this 157 */ 158 usernm = env_get("LOGNAME", e->envp); --- 82 unchanged lines hidden --- |