Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Aug 2002 03:04:27 -0700
From:      Sean Chittenden <sean@chittenden.org>
To:        current@freebsd.org
Subject:   w/uptime warning inappropriately under xdm/kdm [patch]...
Message-ID:  <20020809100427.GA65519@ninja1.internal>

next in thread | raw e-mail | index | archive | help

--xHFwDpU9dbj6ez1V
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

I've switched one of my desktops to using kdm and I've noticed that
w(1) creates suprious warnings because it can't find the tty entry.

$ w
w: /dev/:0: No such file or directory
w: /dev/:0: No such file or directory
 2:41AM  up 49 mins, 0 users, load averages: 0.05, 0.04, 0.04
USER             TTY      FROM              LOGIN@  IDLE WHAT
$ 

I've included a patch that quiets this.  The attached patch is inline
with the behavior from who(1).  Are there any objections to it?  What
should be the correct behaviour when loggin in via xdm/kdm?  Is there
a better way to detect that you're logged in via xdm/kdm?  Should w(1)
iterate through utmp/wtmp to get user info?  -sc

-- 
Sean Chittenden

--xHFwDpU9dbj6ez1V
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch

Index: w.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/w/w.c,v
retrieving revision 1.54
diff -u -r1.54 w.c
--- w.c	2002/06/07 01:41:54	1.54
+++ w.c	2002/08/09 09:57:17
@@ -491,11 +491,10 @@
 	char ttybuf[MAXPATHLEN];
 
 	(void)snprintf(ttybuf, sizeof(ttybuf), "%s%.*s", _PATH_DEV, sz, line);
-	if (stat(ttybuf, &sb)) {
-		warn("%s", ttybuf);
+	if (stat(ttybuf, &sb) == 0) {
+		return (&sb);
+	} else
 		return (NULL);
-	}
-	return (&sb);
 }
 
 static void

--xHFwDpU9dbj6ez1V--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020809100427.GA65519>