popen.c (11cd3c9f) popen.c (14852038)
1/* $OpenBSD: popen.c,v 1.11 2001/10/01 19:19:09 millert Exp $ */
1/* $OpenBSD: popen.c,v 1.12 2001/10/24 17:28:16 millert Exp $ */
2
3/*
4 * Copyright (c) 1988, 1993, 1994
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software written by Ken Arnold and
8 * published in UNIX Review, Vol. 6, No. 8.
9 *

--- 23 unchanged lines hidden (view full) ---

33 * SUCH DAMAGE.
34 *
35 */
36
37#ifndef lint
38#if 0
39static char sccsid[] = "@(#)popen.c 8.3 (Berkeley) 4/6/94";
40#else
2
3/*
4 * Copyright (c) 1988, 1993, 1994
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software written by Ken Arnold and
8 * published in UNIX Review, Vol. 6, No. 8.
9 *

--- 23 unchanged lines hidden (view full) ---

33 * SUCH DAMAGE.
34 *
35 */
36
37#ifndef lint
38#if 0
39static char sccsid[] = "@(#)popen.c 8.3 (Berkeley) 4/6/94";
40#else
41static char rcsid[] = "$OpenBSD: popen.c,v 1.11 2001/10/01 19:19:09 millert Exp $";
41static char rcsid[] = "$OpenBSD: popen.c,v 1.12 2001/10/24 17:28:16 millert Exp $";
42#endif
43#endif /* not lint */
44
45#include "cron.h"
46
47#define MAX_ARGV 100
48#define MAX_GARGV 1000
49#define WANT_GLOBBING 0

--- 98 unchanged lines hidden (view full) ---

148 setlogin(env_get("LOGNAME", e->envp));
149 if (setuid(e->uid))
150 _exit(1);
151 chdir(env_get("HOME", e->envp));
152#endif /* LOGIN_CAP */
153 }
154 closelog();
155 if (*type == 'r') {
42#endif
43#endif /* not lint */
44
45#include "cron.h"
46
47#define MAX_ARGV 100
48#define MAX_GARGV 1000
49#define WANT_GLOBBING 0

--- 98 unchanged lines hidden (view full) ---

148 setlogin(env_get("LOGNAME", e->envp));
149 if (setuid(e->uid))
150 _exit(1);
151 chdir(env_get("HOME", e->envp));
152#endif /* LOGIN_CAP */
153 }
154 closelog();
155 if (*type == 'r') {
156 if (pdes[1] != STDOUT_FILENO) {
157 dup2(pdes[1], STDOUT_FILENO);
156 if (pdes[1] != STDOUT) {
157 dup2(pdes[1], STDOUT);
158 (void)close(pdes[1]);
159 }
158 (void)close(pdes[1]);
159 }
160 dup2(STDOUT_FILENO, STDERR_FILENO); /* stderr too! */
160 dup2(STDOUT, STDERR); /* stderr too! */
161 (void)close(pdes[0]);
162 } else {
161 (void)close(pdes[0]);
162 } else {
163 if (pdes[0] != STDIN_FILENO) {
164 dup2(pdes[0], STDIN_FILENO);
163 if (pdes[0] != STDIN) {
164 dup2(pdes[0], STDIN);
165 (void)close(pdes[0]);
166 }
167 (void)close(pdes[1]);
168 }
169#if WANT_GLOBBING
170 execvp(gargv[0], gargv);
171#else
172 execvp(argv[0], argv);

--- 53 unchanged lines hidden ---
165 (void)close(pdes[0]);
166 }
167 (void)close(pdes[1]);
168 }
169#if WANT_GLOBBING
170 execvp(gargv[0], gargv);
171#else
172 execvp(argv[0], argv);

--- 53 unchanged lines hidden ---