diff options
author | 1999-09-16 19:05:58 +0000 | |
---|---|---|
committer | 1999-09-16 19:05:58 +0000 | |
commit | 3e0f69c26ccca214b9003841abc51cb0a035bcdd (patch) | |
tree | 4c0e0623adf76a708562eaedab4f504062bd1b68 /lib/libc/gen/exec.c | |
parent | appropiate -> appropriate; inspired by it being misspelled in a NetBSD commit (diff) | |
download | wireguard-openbsd-3e0f69c26ccca214b9003841abc51cb0a035bcdd.tar.xz wireguard-openbsd-3e0f69c26ccca214b9003841abc51cb0a035bcdd.zip |
use writev() where possible
Diffstat (limited to 'lib/libc/gen/exec.c')
-rw-r--r-- | lib/libc/gen/exec.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/libc/gen/exec.c b/lib/libc/gen/exec.c index 98d4a46776b..4da6feb6cd4 100644 --- a/lib/libc/gen/exec.c +++ b/lib/libc/gen/exec.c @@ -32,11 +32,12 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: exec.c,v 1.8 1998/08/14 21:39:23 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: exec.c,v 1.9 1999/09/16 19:05:58 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> #include <sys/types.h> +#include <sys/uio.h> #include <errno.h> #include <unistd.h> #include <stdlib.h> @@ -241,9 +242,15 @@ execvp(name, argv) * the user may execute the wrong program. */ if (lp + ln + 2 > sizeof(buf)) { - (void)write(STDERR_FILENO, "execvp: ", 8); - (void)write(STDERR_FILENO, p, lp); - (void)write(STDERR_FILENO, ": path too long\n", 16); + struct iovec iov[3]; + + iov[0].iov_base = "execvp: "; + iov[0].iov_len = 8; + iov[1].iov_base = p; + iov[1].iov_len = lp; + iov[2].iov_base = ": path too long\n"; + iov[2].iov_len = 16; + (void)writev(STDERR_FILENO, iov, 3); continue; } bcopy(p, buf, lp); |