From: Rob Landley Date: Wed, 11 Sep 2013 17:09:53 +0000 (-0500) Subject: Ah, that's why commit 1057 was skipped last pull: it was unfinished. Oops. (Fix it.) X-Git-Tag: 0.5.0~449 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cd0b70e739055e5e8a5d9d6f823bdd3fa97ee509;p=platform%2Fupstream%2Ftoybox.git Ah, that's why commit 1057 was skipped last pull: it was unfinished. Oops. (Fix it.) --- diff --git a/lib/lib.h b/lib/lib.h index a71582c..fe494e7 100644 --- a/lib/lib.h +++ b/lib/lib.h @@ -158,7 +158,7 @@ void replace_tempfile(int fdin, int fdout, char **tempname); void crc_init(unsigned int *crc_table, int little_endian); void terminal_size(unsigned *x, unsigned *y); int yesno(char *prompt, int def); -void for_each_pid_with_name_in(char **names, int (*callback)(pid_t pid, char *name)); +void names_to_pid(char **names, int (*callback)(pid_t pid, char *name)); // net.c int xsocket(int domain, int type, int protocol); diff --git a/lib/pending.c b/lib/pending.c index eda45b4..d0cf3e2 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); diff --git a/toys/lsb/pidof.c b/toys/lsb/pidof.c index 70582a5..7ef5403 100644 --- a/toys/lsb/pidof.c +++ b/toys/lsb/pidof.c @@ -49,6 +49,6 @@ static int print_pid(pid_t pid, char * name) void pidof_main(void) { toys.exitval = 1; - name_to_pid(toys.optargs, print_pid); + names_to_pid(toys.optargs, print_pid); if (!toys.exitval) xputc('\n'); }