]> granicus.if.org Git - procps-ng/commitdiff
skill: Simplify the kill_main() loop.
authorQualys Security Advisory <qsa@qualys.com>
Thu, 1 Jan 1970 00:00:00 +0000 (00:00 +0000)
committerCraig Small <csmall@enc.com.au>
Fri, 18 May 2018 21:32:21 +0000 (07:32 +1000)
Right now the "loop=0; break;" is never reached.

skill.c

diff --git a/skill.c b/skill.c
index 59c6c7656bc5ebbfefa4e08f166f120b2029de01..1a5b3e031c1e9b9f575c37e0378f2979536ed347 100644 (file)
--- a/skill.c
+++ b/skill.c
@@ -419,7 +419,6 @@ static void __attribute__ ((__noreturn__))
     kill_main(int argc, char **argv)
 {
        int signo, i;
-       int loop = 1;
        long pid;
        int exitvalue = EXIT_SUCCESS;
     char *sig_option;
@@ -446,7 +445,7 @@ static void __attribute__ ((__noreturn__))
                signo = SIGTERM;
 
        opterr=0; /* suppress errors on -123 */
-       while (loop == 1 && (i = getopt_long(argc, argv, "l::Ls:hV", longopts, NULL)) != -1)
+       while ((i = getopt_long(argc, argv, "l::Ls:hV", longopts, NULL)) != -1)
                switch (i) {
                case 'l':
             sig_option = NULL;
@@ -491,8 +490,7 @@ static void __attribute__ ((__noreturn__))
                                exitvalue = EXIT_FAILURE;
                            exit(exitvalue);
                        }
-                       loop=0;
-                       break;
+                       xerrx(EXIT_FAILURE, _("internal error"));
                default:
                        kill_usage(stderr);
                }