X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=kill.c;h=0487f6a66190b003e898aaa0f7107b62a5bd0e8b;hb=c3f5c9c2eeb9b9501e54b3cee7e7bdf9f1f3110e;hp=db4842457595cfff0772840f74fd9aa50e1903ca;hpb=5d68857b9cc6f454046dd1397af93890fd298d8e;p=oweals%2Fbusybox.git diff --git a/kill.c b/kill.c index db4842457..0487f6a66 100644 --- a/kill.c +++ b/kill.c @@ -32,16 +32,22 @@ #include static const char *kill_usage = - "kill [-signal] process-id [process-id ...]\n\n" - "Send a signal (default is SIGTERM) to the specified process(es).\n\n" - "Options:\n" "\t-l\tList all signal names and numbers.\n\n"; + "kill [-signal] process-id [process-id ...]\n" +#ifndef BB_FEATURE_TRIVIAL_HELP + "\nSend a signal (default is SIGTERM) to the specified process(es).\n\n" + "Options:\n" "\t-l\tList all signal names and numbers.\n\n" +#endif + ; #ifdef BB_KILLALL static const char *killall_usage = - "killall [-signal] process-name [process-name ...]\n\n" - "Send a signal (default is SIGTERM) to the specified process(es).\n\n" - "Options:\n" "\t-l\tList all signal names and numbers.\n\n"; + "killall [-signal] process-name [process-name ...]\n" +#ifndef BB_FEATURE_TRIVIAL_HELP + "\nSend a signal (default is SIGTERM) to the specified process(es).\n\n" + "Options:\n" "\t-l\tList all signal names and numbers.\n\n" +#endif #endif + ; #define KILL 0 #define KILLALL 1 @@ -222,12 +228,15 @@ extern int kill_main(int argc, char **argv) } #ifdef BB_KILLALL else { + pid_t myPid=getpid(); /* Looks like they want to do a killall. Do that */ while (--argc >= 0) { pid_t* pidList; pidList = findPidByName( *argv); - for(; pidList && pidList!=0; pidList++) { + for(; pidList && *pidList!=0; pidList++) { + if (*pidList==myPid) + continue; if (kill(*pidList, sig) != 0) fatalError( "Could not kill pid '%d': %s\n", *pidList, strerror(errno)); }