summaryrefslogtreecommitdiff
path: root/usr.bin/who
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2021-07-12 15:09:23 +0000
committerBob Beck <beck@cvs.openbsd.org>2021-07-12 15:09:23 +0000
commit73e82762d46ada77045a4c76185bdd75e2e712c3 (patch)
tree1e6fb3124598f66f9f86720c24b0174176b345c2 /usr.bin/who
parente8f12d212e4dfa88699628d0df2a4e442a348350 (diff)
Change the error reporting pattern throughout the tree when unveil
fails to report the path that the failure occured on. Suggested by deraadt@ after some tech discussion. Work done and verified by Ashton Fagg <ashton@fagg.id.au> ok deraadt@ semarie@ claudio@
Diffstat (limited to 'usr.bin/who')
-rw-r--r--usr.bin/who/who.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.bin/who/who.c b/usr.bin/who/who.c
index a625d440582..c1582a0675e 100644
--- a/usr.bin/who/who.c
+++ b/usr.bin/who/who.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: who.c,v 1.29 2020/08/27 15:20:31 semarie Exp $ */
+/* $OpenBSD: who.c,v 1.30 2021/07/12 15:09:20 beck Exp $ */
/* $NetBSD: who.c,v 1.4 1994/12/07 04:28:49 jtc Exp $ */
/*
@@ -113,7 +113,7 @@ main(int argc, char *argv[])
if (show_quick) {
only_current_term = show_term = show_idle = show_labels = 0;
}
-
+
if (show_term)
hostwidth -= 2;
if (show_idle)
@@ -123,10 +123,10 @@ main(int argc, char *argv[])
output_labels();
if (unveil(_PATH_UTMP, "r") == -1)
- err(1, "unveil");
+ err(1, "unveil %s", _PATH_UTMP);
if (show_term || show_idle) {
if (unveil(_PATH_DEV, "r") == -1)
- err(1, "unveil");
+ err(1, "unveil %s", _PATH_DEV);
}
switch (argc) {
case 0: /* who */
@@ -138,7 +138,7 @@ main(int argc, char *argv[])
who_am_i(ufp);
} else if (show_quick) {
int count = 0;
-
+
while (fread((char *)&usr, sizeof(usr), 1, ufp) == 1) {
if (*usr.ut_name && *usr.ut_line) {
(void)printf("%-*.*s ", NAME_WIDTH,
@@ -159,7 +159,7 @@ main(int argc, char *argv[])
break;
case 1: /* who utmp_file */
if (unveil(*argv, "r") == -1)
- err(1, "unveil");
+ err(1, "unveil %s", *argv);
if (pledge("stdio rpath getpw", NULL) == -1)
err(1, "pledge");
ufp = file(*argv);