Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-10-22 16:21:15 +0400
committerEric Andersen <andersen@codepoet.org>2002-10-22 16:21:15 +0400
commit44608e9693b03661fbab5e27650bb040c6871d11 (patch)
tree4555230653cdb82d998f076b29130d8fe18a6f7a /procps/pidof.c
parent1887b0478f2743ce7808e8b37462e18d584611e1 (diff)
Patch last_pach62 from vodz. This patch moves all the /proc parsing
code into libbb so it can be shared by ps, top, etc, saving over 1.5k.
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)
while(optind < argc) {
long* pidList;
- pidList = find_pid_by_name( argv[optind]);
- if (!pidList || *pidList<=0) {
- break;
- }
-
- for(; pidList && *pidList!=0; pidList++) {
+ pidList = find_pid_by_name(argv[optind]);
+ for(; *pidList > 0; pidList++) {
printf("%s%ld", (n++ ? " " : ""), (long)*pidList);
fail = 0;
if (single_flag)
break;
}
- /* Note that we don't bother to free the memory
- * allocated in find_pid_by_name(). It will be freed
- * upon exit, so we can save a byte or two */
+ free(pidList);
optind++;
+
}
printf("\n");