exec.c (53733) | exec.c (54914) |
---|---|
1/*- 2 * Copyright (c) 1999 Brian Somers <brian@Awfulhak.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 1999 Brian Somers <brian@Awfulhak.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/usr.sbin/ppp/exec.c 53733 1999-11-26 22:44:33Z brian $ | 26 * $FreeBSD: head/usr.sbin/ppp/exec.c 54914 1999-12-20 20:30:02Z brian $ |
27 */ 28 29#include <sys/param.h> 30#include <sys/socket.h> 31#include <sys/un.h> 32 33#include <errno.h> 34#include <fcntl.h> --- 101 unchanged lines hidden (view full) --- 136 log_Printf(LogPHASE, "Unable to fork to drop parent: %s\n", 137 strerror(errno)); 138 default: 139 _exit(127); 140 } 141 142 log_Printf(LogDEBUG, "Exec'ing ``%s''\n", p->name.base); 143 | 27 */ 28 29#include <sys/param.h> 30#include <sys/socket.h> 31#include <sys/un.h> 32 33#include <errno.h> 34#include <fcntl.h> --- 101 unchanged lines hidden (view full) --- 136 log_Printf(LogPHASE, "Unable to fork to drop parent: %s\n", 137 strerror(errno)); 138 default: 139 _exit(127); 140 } 141 142 log_Printf(LogDEBUG, "Exec'ing ``%s''\n", p->name.base); 143 |
144 if ((argc = MakeArgs(p->name.base, argv, VECSIZE(argv))) < 0) { 145 log_Printf(LogWARN, "Syntax error in exec command\n"); 146 _exit(127); 147 } 148 149 command_Expand(argv, argc, (char const *const *)argv, 150 p->dl->bundle, 0, realpid); 151 |
|
144 dup2(fids[1], STDIN_FILENO); 145 dup2(fids[1], STDOUT_FILENO); 146 dup2(fids[1], STDERR_FILENO); 147 for (i = getdtablesize(); i > STDERR_FILENO; i--) 148 fcntl(i, F_SETFD, 1); 149 | 152 dup2(fids[1], STDIN_FILENO); 153 dup2(fids[1], STDOUT_FILENO); 154 dup2(fids[1], STDERR_FILENO); 155 for (i = getdtablesize(); i > STDERR_FILENO; i--) 156 fcntl(i, F_SETFD, 1); 157 |
150 argc = MakeArgs(p->name.base, argv, VECSIZE(argv)); 151 command_Expand(argv, argc, (char const *const *)argv, 152 p->dl->bundle, 0, realpid); | |
153 execvp(*argv, argv); 154 printf("execvp failed: %s: %s\r\n", *argv, strerror(errno)); 155 _exit(127); 156 break; 157 158 default: 159 close(fids[1]); 160 p->fd = fids[0]; --- 12 unchanged lines hidden --- | 158 execvp(*argv, argv); 159 printf("execvp failed: %s: %s\r\n", *argv, strerror(errno)); 160 _exit(127); 161 break; 162 163 default: 164 close(fids[1]); 165 p->fd = fids[0]; --- 12 unchanged lines hidden --- |