X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=procps%2Fpidof.c;h=d9c8dca420a720c543b350be467e0f44f9163aa6;hb=5929edc1fac4340f99ed84e92bf3a2bedd4177c2;hp=c142e33c8750ee3614cad1a073d2c0b51999d395;hpb=a2eec6051f81b272521da3001f52d1e43abde6df;p=oweals%2Fbusybox.git diff --git a/procps/pidof.c b/procps/pidof.c index c142e33c8..d9c8dca42 100644 --- a/procps/pidof.c +++ b/procps/pidof.c @@ -7,7 +7,7 @@ * Licensed under the GPL v2, see the file LICENSE in this tarball. */ - +#include "busybox.h" #include #include #include @@ -17,7 +17,6 @@ #include #include #include -#include "busybox.h" #if ENABLE_FEATURE_PIDOF_SINGLE #define _SINGLE_COMPL(a) a @@ -42,7 +41,7 @@ #define omitted (0) #endif -extern int pidof_main(int argc, char **argv) +int pidof_main(int argc, char **argv) { unsigned n = 0; unsigned fail = 1; @@ -65,14 +64,9 @@ extern int pidof_main(int argc, char **argv) while (omits_p) { /* are we asked to exclude the parent's process ID? */ if (!strncmp(omits_p->data, "%PPID", 5)) { - omits_p = llist_free_one(omits_p); + llist_pop(&omits_p); snprintf(getppid_str, sizeof(getppid_str), "%d", getppid()); - omits_p = llist_add_to(omits_p, getppid_str); -#if 0 - } else { - bb_error_msg_and_die("illegal omit pid value (%s)!\n", - omits_p->data); -#endif + llist_add_to(&omits_p, getppid_str); } omits_p = omits_p->link; } @@ -117,7 +111,7 @@ extern int pidof_main(int argc, char **argv) #if ENABLE_FEATURE_PIDOF_OMIT if (ENABLE_FEATURE_CLEAN_UP) - llist_free(omits); + llist_free(omits, NULL); #endif return fail ? EXIT_FAILURE : EXIT_SUCCESS; }