odd uptime error message

Robert Watson rwatson at freebsd.org
Fri Aug 15 14:08:49 PDT 2003


On Fri, 15 Aug 2003, Jonathan Chen wrote:

> On Thu, Aug 14, 2003 at 02:14:07PM -0700, Eric S wrote:
> > 
> > I checked the archives and /usr/src/UPDATING and didn't see anything
> > relating to this, and I might have easily missed it in the digest.  I've
> > got two different boxes that are running a recent -stable, and recently
> > they both started spitting out the error message
> > 
> > 	uptime: /dev/:0: No such file or directory
> 
> It's in the archives:
> 
>     http://lists.freebsd.org/pipermail/freebsd-questions/2003-April/004276.html
> 
> You can fiddle with /usr/local/share/config/kdm/Xreset and Xstartup to
> get rid of this message. I personally use "-l console" 

I fixed an almost identical bug (feature) in finger in -CURRENT a couple
of months ago.  As with w, et a., finger attempts to stat each of the
terminals listed in utmp.  The fix is to ignore ENOENT in whatever code it
is that's attempting to stat the terminals and skip the terminal in
question.  In fact, it looks like this has even been fixed in -CURRENT
already:

  revision 1.55
  date: 2002/08/23 04:31:58;  author: seanc;  state: Exp;  lines: +3 -4
  Fix warning when calling w(1) when logged in via xdm/kdm.  This is
  really a problem with utmp/wtmp, but takes the same approach as who(1).
  
  Reviewed by:    knu (mentor), mini, silence on -audit
  Approved by:    knu (mentor), mini

The attached patch probably does what you want -- if so, let me know, and
I'll commit it.  Apply the patch in src/usr.bin/w; then make, make
install.  If the finger patch hasn't been merged, it probably should be
also.

Robert N M Watson             FreeBSD Core Team, TrustedBSD Projects
robert at fledge.watson.org      Network Associates Laboratories

-------------- next part --------------
Index: w.c
===================================================================
RCS file: /data/ncvs/src/usr.bin/w/w.c,v
retrieving revision 1.38.2.6
diff -u -r1.38.2.6 w.c
--- w.c	12 Mar 2002 19:51:51 -0000	1.38.2.6
+++ w.c	15 Aug 2003 21:06:40 -0000
@@ -505,11 +505,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


More information about the freebsd-stable mailing list