Don't bomb if we can't find a process for a tty.
authorCraig Leres <leres@ucbvax.Berkeley.EDU>
Sat, 2 Nov 1991 10:17:09 +0000 (02:17 -0800)
committerCraig Leres <leres@ucbvax.Berkeley.EDU>
Sat, 2 Nov 1991 10:17:09 +0000 (02:17 -0800)
SCCS-vsn: usr.bin/w/w.c 5.30

usr/src/usr.bin/w/w.c

index 2d2912e..7adcc5d 100644 (file)
@@ -12,7 +12,7 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)w.c        5.29 (Berkeley) %G%";
+static char sccsid[] = "@(#)w.c        5.30 (Berkeley) %G%";
 #endif /* not lint */
 
 /*
 #endif /* not lint */
 
 /*
@@ -263,6 +263,10 @@ main(argc, argv)
        if (argwidth < 4)
                argwidth = 8;
        for (ep = ehead; ep != NULL; ep = ep->next) {
        if (argwidth < 4)
                argwidth = 8;
        for (ep = ehead; ep != NULL; ep = ep->next) {
+               if (ep->proc == 0) {
+                       ep->args = "-";
+                       continue;
+               }
                ep->args = strdup(kvm_getargs(ep->proc, kvm_getu(ep->proc)));
                if (ep->args == NULL) {
                        error("out of memory");
                ep->args = strdup(kvm_getargs(ep->proc, kvm_getu(ep->proc)));
                if (ep->args == NULL) {
                        error("out of memory");