diff options
author | 2003-07-15 23:30:47 +0000 | |
---|---|---|
committer | 2003-07-15 23:30:47 +0000 | |
commit | 87fdc3ff45bd4693b2c03535b8a7dfdf5c516f2c (patch) | |
tree | e3c94e9fd8de98330e6beaca8705bb22ba89c307 | |
parent | Fix line ranges for unidiffs. Problem noted by otto@ (diff) | |
download | wireguard-openbsd-87fdc3ff45bd4693b2c03535b8a7dfdf5c516f2c.tar.xz wireguard-openbsd-87fdc3ff45bd4693b2c03535b8a7dfdf5c516f2c.zip |
can't use err after vfork. ok millert
-rw-r--r-- | usr.bin/xargs/xargs.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/usr.bin/xargs/xargs.c b/usr.bin/xargs/xargs.c index d63f742aeab..551451dda25 100644 --- a/usr.bin/xargs/xargs.c +++ b/usr.bin/xargs/xargs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xargs.c,v 1.16 2003/06/13 16:54:00 millert Exp $ */ +/* $OpenBSD: xargs.c,v 1.17 2003/07/15 23:30:47 tedu Exp $ */ /* $FreeBSD: xargs.c,v 1.51 2003/05/03 19:09:11 obrien Exp $ */ /*- @@ -45,7 +45,7 @@ static const char copyright[] = #if 0 static const char sccsid[] = "@(#)xargs.c 8.1 (Berkeley) 6/6/93"; #else -static const char rcsid[] = "$OpenBSD: xargs.c,v 1.16 2003/06/13 16:54:00 millert Exp $"; +static const char rcsid[] = "$OpenBSD: xargs.c,v 1.17 2003/07/15 23:30:47 tedu Exp $"; #endif #endif /* not lint */ @@ -523,14 +523,18 @@ exec: err(1, "vfork"); case 0: if (oflag) { - if ((fd = open(_PATH_TTY, O_RDONLY)) == -1) - err(1, "can't open /dev/tty"); + if ((fd = open(_PATH_TTY, O_RDONLY)) == -1) { + warn("can't open /dev/tty"); + _exit(1); + } } else { fd = open(_PATH_DEVNULL, O_RDONLY); } if (fd > STDIN_FILENO) { - if (dup2(fd, STDIN_FILENO) != 0) - err(1, "can't dup2 to stdin"); + if (dup2(fd, STDIN_FILENO) != 0) { + warn("can't dup2 to stdin"); + _exit(1); + } close(fd); } execvp(argv[0], argv); |