diff options
author | 2015-07-19 01:19:22 +0000 | |
---|---|---|
committer | 2015-07-19 01:19:22 +0000 | |
commit | 1aced516abfbcbe87f6196682831955b153ba568 (patch) | |
tree | 54f365c30ed79a4723634625ebaaae792d8e87d0 | |
parent | Fix Coverity 72742 - ret is overwritten immediately after this. (diff) | |
download | wireguard-openbsd-1aced516abfbcbe87f6196682831955b153ba568.tar.xz wireguard-openbsd-1aced516abfbcbe87f6196682831955b153ba568.zip |
sudo emulation: if execvpe fails with ENOENT, print "command not found"
requested by krw
-rw-r--r-- | usr.bin/doas/doas.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/doas/doas.c b/usr.bin/doas/doas.c index b90831c73e6..23074b4322a 100644 --- a/usr.bin/doas/doas.c +++ b/usr.bin/doas/doas.c @@ -1,4 +1,4 @@ -/* $OpenBSD: doas.c,v 1.9 2015/07/18 18:44:26 tedu Exp $ */ +/* $OpenBSD: doas.c,v 1.10 2015/07/19 01:19:22 tedu Exp $ */ /* * Copyright (c) 2015 Ted Unangst <tedu@openbsd.org> * @@ -29,6 +29,7 @@ #include <pwd.h> #include <grp.h> #include <syslog.h> +#include <errno.h> #include "doas.h" @@ -343,5 +344,7 @@ main(int argc, char **argv, char **envp) if (setenv("PATH", safepath, 1) == -1) err(1, "failed to set PATH '%s'", safepath); execvpe(cmd, argv, envp); + if (errno == ENOENT) + errx(1, "%s: command not found", cmd); err(1, "%s", cmd); } |