diff options
author | Denis Vlasenko | 2007-11-25 04:54:13 +0000 |
---|---|---|
committer | Denis Vlasenko | 2007-11-25 04:54:13 +0000 |
commit | 6446c2d4aba02eef0d8553c882f8d235288a66d9 (patch) | |
tree | 1637549e2c7e6432e6ec36774d0e5aa48e0bf44e /procps | |
parent | 72e76044cfda377486a5199a0d35d71edf669a42 (diff) | |
download | busybox-6446c2d4aba02eef0d8553c882f8d235288a66d9.zip busybox-6446c2d4aba02eef0d8553c882f8d235288a66d9.tar.gz |
which: fix testsuite failure
pidof: do not output empty line if nothing found
testsuite: disable false positive
Diffstat (limited to 'procps')
-rw-r--r-- | procps/pidof.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/procps/pidof.c b/procps/pidof.c index f295617..86d1957 100644 --- a/procps/pidof.c +++ b/procps/pidof.c @@ -47,12 +47,13 @@ int pidof_main(int argc, char **argv) } #endif /* Looks like everything is set to go. */ - while (optind < argc) { + argv += optind; + while (*argv) { pid_t *pidList; pid_t *pl; /* reverse the pidlist like GNU pidof does. */ - pidList = pidlist_reverse(find_pid_by_name(argv[optind])); + pidList = pidlist_reverse(find_pid_by_name(*argv)); for (pl = pidList; *pl; pl++) { #if ENABLE_FEATURE_PIDOF_OMIT if (opt & OPT_OMIT) { @@ -74,9 +75,10 @@ int pidof_main(int argc, char **argv) #endif } free(pidList); - optind++; + argv++; } - bb_putchar('\n'); + if (!first) + bb_putchar('\n'); #if ENABLE_FEATURE_PIDOF_OMIT if (ENABLE_FEATURE_CLEAN_UP) |