From 6446c2d4aba02eef0d8553c882f8d235288a66d9 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sun, 25 Nov 2007 04:54:13 +0000 Subject: which: fix testsuite failure pidof: do not output empty line if nothing found testsuite: disable false positive --- procps/pidof.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'procps') 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) -- cgit v1.1