aboutsummaryrefslogtreecommitdiff
path: root/procps/pidof.c
diff options
context:
space:
mode:
Diffstat (limited to 'procps/pidof.c')
-rw-r--r--procps/pidof.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/procps/pidof.c b/procps/pidof.c
index d0d65e0db..169a92007 100644
--- a/procps/pidof.c
+++ b/procps/pidof.c
@@ -54,21 +54,16 @@ extern int pidof_main(int argc, char **argv)
54 while(optind < argc) { 54 while(optind < argc) {
55 long* pidList; 55 long* pidList;
56 56
57 pidList = find_pid_by_name( argv[optind]); 57 pidList = find_pid_by_name(argv[optind]);
58 if (!pidList || *pidList<=0) { 58 for(; *pidList > 0; pidList++) {
59 break;
60 }
61
62 for(; pidList && *pidList!=0; pidList++) {
63 printf("%s%ld", (n++ ? " " : ""), (long)*pidList); 59 printf("%s%ld", (n++ ? " " : ""), (long)*pidList);
64 fail = 0; 60 fail = 0;
65 if (single_flag) 61 if (single_flag)
66 break; 62 break;
67 } 63 }
68 /* Note that we don't bother to free the memory 64 free(pidList);
69 * allocated in find_pid_by_name(). It will be freed
70 * upon exit, so we can save a byte or two */
71 optind++; 65 optind++;
66
72 } 67 }
73 printf("\n"); 68 printf("\n");
74 69