diff options
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 f29561789..86d1957a6 100644 --- a/procps/pidof.c +++ b/procps/pidof.c | |||
@@ -47,12 +47,13 @@ int pidof_main(int argc, char **argv) | |||
47 | } | 47 | } |
48 | #endif | 48 | #endif |
49 | /* Looks like everything is set to go. */ | 49 | /* Looks like everything is set to go. */ |
50 | while (optind < argc) { | 50 | argv += optind; |
51 | while (*argv) { | ||
51 | pid_t *pidList; | 52 | pid_t *pidList; |
52 | pid_t *pl; | 53 | pid_t *pl; |
53 | 54 | ||
54 | /* reverse the pidlist like GNU pidof does. */ | 55 | /* reverse the pidlist like GNU pidof does. */ |
55 | pidList = pidlist_reverse(find_pid_by_name(argv[optind])); | 56 | pidList = pidlist_reverse(find_pid_by_name(*argv)); |
56 | for (pl = pidList; *pl; pl++) { | 57 | for (pl = pidList; *pl; pl++) { |
57 | #if ENABLE_FEATURE_PIDOF_OMIT | 58 | #if ENABLE_FEATURE_PIDOF_OMIT |
58 | if (opt & OPT_OMIT) { | 59 | if (opt & OPT_OMIT) { |
@@ -74,9 +75,10 @@ int pidof_main(int argc, char **argv) | |||
74 | #endif | 75 | #endif |
75 | } | 76 | } |
76 | free(pidList); | 77 | free(pidList); |
77 | optind++; | 78 | argv++; |
78 | } | 79 | } |
79 | bb_putchar('\n'); | 80 | if (!first) |
81 | bb_putchar('\n'); | ||
80 | 82 | ||
81 | #if ENABLE_FEATURE_PIDOF_OMIT | 83 | #if ENABLE_FEATURE_PIDOF_OMIT |
82 | if (ENABLE_FEATURE_CLEAN_UP) | 84 | if (ENABLE_FEATURE_CLEAN_UP) |