]> granicus.if.org Git - psmisc/commitdiff
killall: Fix -INT option parsing
authorCraig Small <csmall@enc.com.au>
Sun, 20 May 2018 10:42:12 +0000 (20:42 +1000)
committerCraig Small <csmall@enc.com.au>
Sun, 20 May 2018 10:42:12 +0000 (20:42 +1000)
Sometimes killall gets confused between a signal name and a set of
options. This small patch should un-confuse it.

ChangeLog
src/killall.c

index 5c7cc6b069024be4045380a947b97dc0f166b46d..087c9474fcd2af939be3dd8b9282fa54b8b14834 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 Changes in 23.2
 ===============
        * killall: look at all namespaces by default
+       * killall: Fix -INT option parsing #11
 Changes in 23.1
 ===============
        * killall: Remove debug output Debian: #864753
index 7bb9313863b6b78449dd2f6362cf6e0141b2e07d..5fee135b8badaf896a86002d697a08d91e50effa 100644 (file)
@@ -803,6 +803,7 @@ main (int argc, char **argv)
   int sig_num;
   int optc;
   int myoptind;
+  int skip_error=0;
   struct passwd *pwent = NULL;
   char yt[16];
   char ot[16];
@@ -911,6 +912,7 @@ main (int argc, char **argv)
         ignore_case = 1;
       } else {
              sig_num = get_signal (argv[optind]+1, "killall");
+          skip_error=1;
       }
       break;
     case 'V':
@@ -948,7 +950,10 @@ main (int argc, char **argv)
         if (argv[optind-1][1] >= '0' && argv[optind-1][1] <= '9') {
           sig_num = atoi(argv[optind-1]+1);
         } else {
-          usage(NULL);
+            if (skip_error)
+                skip_error=0;
+            else
+                usage(NULL);
         }
       }
       break;