summaryrefslogtreecommitdiff
path: root/usr.bin/doas/doas.c
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2015-07-19 01:19:23 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2015-07-19 01:19:23 +0000
commite0b0e089e8439f84419101baf54e3f3493dd8689 (patch)
treec2bfecb0d40722b52c5b5dd1632e0a0ea1412146 /usr.bin/doas/doas.c
parentd118c5c2d04cb954fee441735797e8085c24790e (diff)
sudo emulation: if execvpe fails with ENOENT, print "command not found"
requested by krw
Diffstat (limited to 'usr.bin/doas/doas.c')
-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);
}