e_termination should be set to the value of WTERMSIG not WEXITSTATUS

This commit is contained in:
Todd C. Miller
2017-03-08 09:17:53 -07:00
parent af1482f487
commit 78f3f8bb9d

View 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)