]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
login: correction in sig_handler()
authorKarel Zak <kzak@redhat.com>
Fri, 30 Mar 2012 09:14:47 +0000 (11:14 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 30 Mar 2012 09:14:47 +0000 (11:14 +0200)
Reported-by: Avinesh Kumar <avinesh@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
login-utils/login.c

index 4f448f860794cf565e96fb01ae26e51f7ecdcb46..043eaa20a711abcfd5d8dc24c4c9f317b4dbf911 100644 (file)
@@ -186,12 +186,12 @@ static void timedout(int sig __attribute__ ((__unused__)))
  */
 static void sig_handler(int signal)
 {
-       if (child_pid)
+       if (child_pid) {
+               if (signal == SIGTERM)
+                       signal = SIGHUP;        /* because the shell often ignores SIGTERM */
                kill(-child_pid, signal);
-       else
+       else
                got_sig = 1;
-       if (signal == SIGTERM)
-               kill(-child_pid, SIGHUP);       /* because the shell often ignores SIGTERM */
 }
 
 /*