diff options
author | 2015-08-20 18:42:11 +0000 | |
---|---|---|
committer | 2015-08-20 18:42:11 +0000 | |
commit | ce96b37d64e110ea5ad52e68f701a5d98969331a (patch) | |
tree | 63da74ffd26a673e96b2a618a9d45a581e9d6622 | |
parent | Use the IPD Clock Count register as a timecounter, making the clock (diff) | |
download | wireguard-openbsd-ce96b37d64e110ea5ad52e68f701a5d98969331a.tar.xz wireguard-openbsd-ce96b37d64e110ea5ad52e68f701a5d98969331a.zip |
Show program name for permission failure messages.
ok espie@, tedu@.
-rw-r--r-- | usr.bin/doas/doas.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.bin/doas/doas.c b/usr.bin/doas/doas.c index 93ae33c14c7..d7656ba2538 100644 --- a/usr.bin/doas/doas.c +++ b/usr.bin/doas/doas.c @@ -1,4 +1,4 @@ -/* $OpenBSD: doas.c,v 1.36 2015/08/13 16:27:22 espie Exp $ */ +/* $OpenBSD: doas.c,v 1.37 2015/08/20 18:42:11 rzalamena Exp $ */ /* * Copyright (c) 2015 Ted Unangst <tedu@openbsd.org> * @@ -280,10 +280,10 @@ copyenv(const char **oldenvp, struct rule *rule) } static void __dead -fail(void) +permfail(void) { - fprintf(stderr, "Permission denied\n"); - exit(1); + errno = EPERM; + err(1, NULL); } static void __dead @@ -401,7 +401,7 @@ main(int argc, char **argv, char **envp) (const char**)argv + 1)) { syslog(LOG_AUTHPRIV | LOG_NOTICE, "failed command for %s: %s", myname, cmdline); - fail(); + permfail(); } if (!(rule->options & NOPASS)) { @@ -410,7 +410,7 @@ main(int argc, char **argv, char **envp) if (!auth_userokay(myname, NULL, NULL, NULL)) { syslog(LOG_AUTHPRIV | LOG_NOTICE, "failed password for %s", myname); - fail(); + permfail(); } } envp = copyenv((const char **)envp, rule); |