From 78f3f8bb9df0a42ff4dbea054acacec82d5be60b Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Wed, 8 Mar 2017 09:17:53 -0700 Subject: [PATCH] e_termination should be set to the value of WTERMSIG not WEXITSTATUS --- src/utmp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utmp.c b/src/utmp.c index a372a9411..12366b6c2 100644 --- a/src/utmp.c +++ b/src/utmp.c @@ -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) -- 2.40.0