Deleted Added
full compact
popen.c (180963) popen.c (192926)
1/*
2 * Copyright (c) 1988, 1993
3 * The Regents of the University of California. 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, with or without

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

29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33#if defined(LIBC_SCCS) && !defined(lint)
34static char sccsid[] = "@(#)popen.c 8.3 (Berkeley) 5/3/95";
35#endif /* LIBC_SCCS and not lint */
36#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1988, 1993
3 * The Regents of the University of California. 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, with or without

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

29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33#if defined(LIBC_SCCS) && !defined(lint)
34static char sccsid[] = "@(#)popen.c 8.3 (Berkeley) 5/3/95";
35#endif /* LIBC_SCCS and not lint */
36#include <sys/cdefs.h>
37__FBSDID("$FreeBSD: head/lib/libc/gen/popen.c 180963 2008-07-29 16:29:59Z ed $");
37__FBSDID("$FreeBSD: head/lib/libc/gen/popen.c 192926 2009-05-27 19:28:04Z ed $");
38
39#include "namespace.h"
40#include <sys/param.h>
41#include <sys/queue.h>
42#include <sys/wait.h>
43
44#include <signal.h>
45#include <errno.h>

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

186 }
187 if (cur == NULL) {
188 THREAD_UNLOCK();
189 return (-1);
190 }
191 if (last == NULL)
192 SLIST_REMOVE_HEAD(&pidlist, next);
193 else
38
39#include "namespace.h"
40#include <sys/param.h>
41#include <sys/queue.h>
42#include <sys/wait.h>
43
44#include <signal.h>
45#include <errno.h>

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

186 }
187 if (cur == NULL) {
188 THREAD_UNLOCK();
189 return (-1);
190 }
191 if (last == NULL)
192 SLIST_REMOVE_HEAD(&pidlist, next);
193 else
194 SLIST_REMOVE_NEXT(&pidlist, last, next);
194 SLIST_REMOVE_AFTER(last, next);
195 THREAD_UNLOCK();
196
197 (void)fclose(iop);
198
199 do {
200 pid = _wait4(cur->pid, &pstat, 0, (struct rusage *)0);
201 } while (pid == -1 && errno == EINTR);
202
203 free(cur);
204
205 return (pid == -1 ? -1 : pstat);
206}
195 THREAD_UNLOCK();
196
197 (void)fclose(iop);
198
199 do {
200 pid = _wait4(cur->pid, &pstat, 0, (struct rusage *)0);
201 } while (pid == -1 && errno == EINTR);
202
203 free(cur);
204
205 return (pid == -1 ? -1 : pstat);
206}