popen.c (133936) | popen.c (161764) |
---|---|
1/* $NetBSD: popen.c,v 1.30 2004-08-09 12:56:48 lukem Exp $ */ | 1/* $NetBSD: popen.c,v 1.31 2006/02/01 14:20:14 christos Exp $ */ |
2 3/*- 4 * Copyright (c) 1999-2004 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Luke Mewburn. 9 * --- 59 unchanged lines hidden (view full) --- 69 * 70 */ 71 72#include <sys/cdefs.h> 73#ifndef lint 74#if 0 75static char sccsid[] = "@(#)popen.c 8.3 (Berkeley) 4/6/94"; 76#else | 2 3/*- 4 * Copyright (c) 1999-2004 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Luke Mewburn. 9 * --- 59 unchanged lines hidden (view full) --- 69 * 70 */ 71 72#include <sys/cdefs.h> 73#ifndef lint 74#if 0 75static char sccsid[] = "@(#)popen.c 8.3 (Berkeley) 4/6/94"; 76#else |
77__RCSID("$NetBSD: popen.c,v 1.30 2004-08-09 12:56:48 lukem Exp $"); | 77__RCSID("$NetBSD: popen.c,v 1.31 2006/02/01 14:20:14 christos Exp $"); |
78#endif 79#endif /* not lint */ 80 81#include <sys/types.h> 82#include <sys/param.h> 83#include <sys/wait.h> 84 85#include <errno.h> --- 47 unchanged lines hidden (view full) --- 133 } 134 if (pipe(pdes) < 0) 135 return (NULL); 136 137 if ((sl = sl_init()) == NULL) 138 goto pfree; 139 140 /* glob each piece */ | 78#endif 79#endif /* not lint */ 80 81#include <sys/types.h> 82#include <sys/param.h> 83#include <sys/wait.h> 84 85#include <errno.h> --- 47 unchanged lines hidden (view full) --- 133 } 134 if (pipe(pdes) < 0) 135 return (NULL); 136 137 if ((sl = sl_init()) == NULL) 138 goto pfree; 139 140 /* glob each piece */ |
141 if (sl_add(sl, xstrdup(argv[0])) == -1) | 141 if (sl_add(sl, ftpd_strdup(argv[0])) == -1) |
142 goto pfree; 143 for (argc = 1; argv[argc]; argc++) { 144 glob_t gl; 145 int flags = GLOB_BRACE|GLOB_NOCHECK|GLOB_TILDE|GLOB_LIMIT; 146 147 memset(&gl, 0, sizeof(gl)); 148 if (glob(argv[argc], flags, NULL, &gl)) { | 142 goto pfree; 143 for (argc = 1; argv[argc]; argc++) { 144 glob_t gl; 145 int flags = GLOB_BRACE|GLOB_NOCHECK|GLOB_TILDE|GLOB_LIMIT; 146 147 memset(&gl, 0, sizeof(gl)); 148 if (glob(argv[argc], flags, NULL, &gl)) { |
149 if (sl_add(sl, xstrdup(argv[argc])) == -1) { | 149 if (sl_add(sl, ftpd_strdup(argv[argc])) == -1) { |
150 globfree(&gl); 151 goto pfree; 152 } 153 } else { 154 for (pop = gl.gl_pathv; *pop; pop++) { | 150 globfree(&gl); 151 goto pfree; 152 } 153 } else { 154 for (pop = gl.gl_pathv; *pop; pop++) { |
155 if (sl_add(sl, xstrdup(*pop)) == -1) { | 155 if (sl_add(sl, ftpd_strdup(*pop)) == -1) { |
156 globfree(&gl); 157 goto pfree; 158 } 159 } 160 } 161 globfree(&gl); 162 } 163 if (sl_add(sl, NULL) == -1) --- 87 unchanged lines hidden --- | 156 globfree(&gl); 157 goto pfree; 158 } 159 } 160 } 161 globfree(&gl); 162 } 163 if (sl_add(sl, NULL) == -1) --- 87 unchanged lines hidden --- |