aboutsummaryrefslogtreecommitdiff
path: root/lib/pending.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2013-09-11 12:09:53 -0500
committerRob Landley <rob@landley.net>2013-09-11 12:09:53 -0500
commitcd0b70e739055e5e8a5d9d6f823bdd3fa97ee509 (patch)
treeaee5f419a7ba2471bb43c404121bb43df8abdce7 /lib/pending.c
parent9b9a1ef58763c9a6fc0cd23f125353716824b8bc (diff)
downloadtoybox-cd0b70e739055e5e8a5d9d6f823bdd3fa97ee509.tar.gz
Ah, that's why commit 1057 was skipped last pull: it was unfinished. Oops. (Fix it.)0.4.6
Diffstat (limited to 'lib/pending.c')
-rw-r--r--lib/pending.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/pending.c b/lib/pending.c
index eda45b40..d0cf3e26 100644
--- a/lib/pending.c
+++ b/lib/pending.c
@@ -6,7 +6,7 @@
#include "toys.h"
// Execute a callback for each PID that matches a process name from a list.
-void name_to_pid(char **names, int (*callback)(pid_t pid, char *name))
+void names_to_pid(char **names, int (*callback)(pid_t pid, char *name))
{
DIR *dp;
struct dirent *entry;
@@ -14,7 +14,6 @@ void name_to_pid(char **names, int (*callback)(pid_t pid, char *name))
if (!(dp = opendir("/proc"))) perror_exit("opendir");
while ((entry = readdir(dp))) {
- int fd, n;
unsigned u;
char *cmd, **curname;
@@ -23,9 +22,9 @@ void name_to_pid(char **names, int (*callback)(pid_t pid, char *name))
if (!(cmd = readfile(libbuf, libbuf, sizeof(libbuf)))) continue;
for (curname = names; *curname; curname++)
- if (*curname == '/' ? !strcmp(cmd, *curname)
- : !strcmp(basename(cmd), basename(*curname))
- if (!callback(u, *curname)) break;
+ if (**curname == '/' ? !strcmp(cmd, *curname)
+ : !strcmp(basename(cmd), basename(*curname)))
+ if (callback(u, *curname)) break;
if (*curname) break;
}
closedir(dp);