]> granicus.if.org Git - sudo/commitdiff
e_termination should be set to the value of WTERMSIG not WEXITSTATUS
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 8 Mar 2017 16:17:53 +0000 (09:17 -0700)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 8 Mar 2017 16:17:53 +0000 (09:17 -0700)
src/utmp.c

index a372a9411c88fd9270b8f11937864fe9581dafe3..12366b6c20f40d46a21da507b7fcbbee5111a314 100644 (file)
@@ -219,8 +219,8 @@ utmp_logout(const char *line, int status)
        ut->ut_type = DEAD_PROCESS;
 # endif
 # if defined(HAVE_STRUCT_UTMPX_UT_EXIT) || defined(HAVE_STRUCT_UTMP_UT_EXIT)
-       ut->ut_exit.__e_exit = WEXITSTATUS(status);
-       ut->ut_exit.__e_termination = WIFEXITED(status) ? WEXITSTATUS(status) : 0;
+       ut->ut_exit.__e_termination = WIFSIGNALED(status) ? WTERMSIG(status) : 0;
+       ut->ut_exit.__e_exit = WIFEXITED(status) ? WEXITSTATUS(status) : 0;
 # endif
        utmp_settime(ut);
        if (pututxline(ut) != NULL)