From f71f8485efbed0ecdd213c4e6d0c9403aa1fcd79 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Mon, 12 Mar 2018 09:04:33 -0700 Subject: Fix bug in names_to_pid. Found by the compiler, not me: lib/lib.c:1053:30: warning: 'st2.st_dev' may be used uninitialized in this function [-Wmaybe-uninitialized] if (st1.st_dev != st2.st_dev || st1.st_ino != st2.st_ino) continue; ~~~^~~~~~~ --- lib/lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lib.c b/lib/lib.c index e5c94791..36c2028b 100644 --- a/lib/lib.c +++ b/lib/lib.c @@ -1049,7 +1049,7 @@ void names_to_pid(char **names, int (*callback)(pid_t pid, char *name)) char buf[32]; sprintf(buf, "/proc/%u/exe", u); - if (stat(buf, &st1)) continue; + if (stat(buf, &st2)) continue; if (st1.st_dev != st2.st_dev || st1.st_ino != st2.st_ino) continue; goto match; } -- cgit v1.2.3