summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2014-03-08 00:09:20 +0000
committerschwarze <schwarze@openbsd.org>2014-03-08 00:09:20 +0000
commitbf5a13243414a9b91d445de52de325fa508a08b1 (patch)
treee1dbc33037889e3098ae92ffa9629389751901c9
parenttoo old, undermaintained (diff)
downloadwireguard-openbsd-bf5a13243414a9b91d445de52de325fa508a08b1.tar.xz
wireguard-openbsd-bf5a13243414a9b91d445de52de325fa508a08b1.zip
Make sure that env(1) always prints a diagnostic message to stderr
if it fails without invoking the utility, such that failure of env(1) and failure of the utility can be distinguished. Without this patch, broken commands like "env =foo myprog" failed silently, now they properly report an invalid argument. OK millert@
-rw-r--r--usr.bin/env/env.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/env/env.c b/usr.bin/env/env.c
index cce897ee7eb..5596e6fc2f2 100644
--- a/usr.bin/env/env.c
+++ b/usr.bin/env/env.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: env.c,v 1.14 2009/10/27 23:59:37 deraadt Exp $ */
+/* $OpenBSD: env.c,v 1.15 2014/03/08 00:09:20 schwarze Exp $ */
/*
* Copyright (c) 1988, 1993, 1994
@@ -66,7 +66,7 @@ main(int argc, char *argv[])
*p++ = '\0';
if (setenv(*argv, p, 1) == -1) {
/* reuse 126, it matches the problem most */
- exit(126);
+ err(126, "setenv");
}
}