misc/121418: ruptime does not show correct information

Atsuo Ohki ohki at gssm.otsuka.tsukuba.ac.jp
Thu Mar 6 06:00:02 UTC 2008


>Number:         121418
>Category:       misc
>Synopsis:       ruptime does not show correct information
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 06 06:00:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Atsuo Ohki
>Release:        7.0-Release
>Organization:
Univesity of Tsukuba
>Environment:
FreeBSD smr01 7.0-RELEASE FreeBSD 7.0-RELEASE #0: Thu Mar  6 14:39:27 JST 2008     ohki at smr01:/usr/src/sys/i386/compile/GENERIC  i386
>Description:
ruptime command give "no hosts in XXX",
while it shoud be.

>How-To-Repeat:

>Fix:
variable `now' is used without initialization.

--- ruptime.c-ORIG      2008-03-06 14:57:39.000000000 +0900
+++ ruptime.c   2008-03-06 14:58:07.000000000 +0900
@@ -191,6 +191,7 @@
        rewinddir(dirp);
        hsp = NULL;
        maxloadav = -1;
+       (void)time(&now);
        for (nhosts = hspace = 0; (dp = readdir(dirp)) != NULL;) {
                if (dp->d_ino == 0 || strncmp(dp->d_name, "whod.", 5) != 0)
                        continue;
@@ -239,7 +240,6 @@
                        warnx("host %s not in %s", host, _PATH_RWHODIR);
        }
 
-       (void)time(&now);
        qsort(hs, nhosts, sizeof(hs[0]), cmp);
        for (i = 0; i < (int)nhosts; i++) {
                hsp = &hs[i];


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list