summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2015-07-19 01:19:22 +0000
committertedu <tedu@openbsd.org>2015-07-19 01:19:22 +0000
commit1aced516abfbcbe87f6196682831955b153ba568 (patch)
tree54f365c30ed79a4723634625ebaaae792d8e87d0
parentFix Coverity 72742 - ret is overwritten immediately after this. (diff)
downloadwireguard-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.c5
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);
}