summaryrefslogtreecommitdiff
path: root/usr.bin/who
diff options
context:
space:
mode:
authorEric Jackson <ericj@cvs.openbsd.org>2000-03-21 21:54:52 +0000
committerEric Jackson <ericj@cvs.openbsd.org>2000-03-21 21:54:52 +0000
commitec6d71e6daf0efe77ee514e978c689f9322a0036 (patch)
treebdc60507ff8931f043c53440e3d82bed1040cf30 /usr.bin/who
parent3867b5dd3c4e5b5ed1fe9ba668f14618f47b8575 (diff)
only chdir() if needed. This affected having who reading different file
Diffstat (limited to 'usr.bin/who')
-rw-r--r--usr.bin/who/who.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.bin/who/who.c b/usr.bin/who/who.c
index 4d57162e315..5fd85231a39 100644
--- a/usr.bin/who/who.c
+++ b/usr.bin/who/who.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: who.c,v 1.7 1999/07/18 01:22:16 deraadt Exp $ */
+/* $OpenBSD: who.c,v 1.8 2000/03/21 21:54:51 ericj Exp $ */
/* $NetBSD: who.c,v 1.4 1994/12/07 04:28:49 jtc Exp $ */
/*
@@ -47,7 +47,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)who.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: who.c,v 1.7 1999/07/18 01:22:16 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: who.c,v 1.8 2000/03/21 21:54:51 ericj Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -116,9 +116,11 @@ main(argc, argv)
only_current_term = show_term = show_idle = show_labels = 0;
}
- if (chdir("/dev")) {
- err(1, "cannot change directory to /dev");
- /* NOTREACHED */
+ if (show_term || show_idle) {
+ if (chdir("/dev")) {
+ err(1, "cannot change directory to /dev");
+ /* NOTREACHED */
+ }
}
if (show_labels)