diff --git a/NEWS b/NEWS index af34e580..6a48ac0d 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,7 @@ ps: fix s format (signals) output with thread display watch: avoid integer overflow for the time delay pwdx: buffer overflow fixed -- thanks Ulf Harnhammar procps.spec needed a slash -- thanks Jesse Brandeburg +w: stale utmp entries snuck in via uninitialized var -- thanks Robert A Basch procps-3.2.5 --> procps-3.2.6 diff --git a/w.c b/w.c index 6daa0589..1b2a0fc0 100644 --- a/w.c +++ b/w.c @@ -132,6 +132,7 @@ static const proc_t *getproc(const utmp_t *restrict const u, const char *restric const proc_t *secondbest = NULL; unsigned uid = ~0U; + *found_utpid = 0; if(!ignoreuser){ char buf[UT_NAMESIZE+1]; struct passwd *passwd_data; /* pointer to static data */ @@ -144,7 +145,6 @@ static const proc_t *getproc(const utmp_t *restrict const u, const char *restric } line = tty_to_dev(tty); *jcpu = 0; - *found_utpid = 0; for(; *pptr; pptr++) { const proc_t *restrict const tmp = *pptr; if(unlikely(tmp->tgid == u->ut_pid)) {