mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-31 22:35:10 +00:00
Add explicit check for struct utmpx.ut_exit.e_termination
and struct utmpx.ut_exit.__e_termination. HP-UX uses the latter. Only update ut_exit if we detect one or the other.
This commit is contained in:
12
src/utmp.c
12
src/utmp.c
@@ -77,6 +77,14 @@ typedef struct utmp sudo_utmp_t;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* HP-UX has __e_termination and __e_exit, others lack the __ */
|
||||
#if defined(HAVE_STRUCT_UTMPX_UT_EXIT_E_TERMINATION) || defined(HAVE_STRUCT_UTMP_UT_EXIT_E_TERMINATION)
|
||||
# undef __e_termination
|
||||
# define __e_termination e_termination
|
||||
# undef __e_exit
|
||||
# define __e_exit e_exit
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_GETUTXID) || defined(HAVE_GETUTID)
|
||||
/*
|
||||
* Create ut_id from the new ut_line and the old ut_id.
|
||||
@@ -208,8 +216,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_exit = WEXITSTATUS(status);
|
||||
ut->ut_exit.__e_termination = WIFEXITED(status) ? WEXITSTATUS(status) : 0;
|
||||
# endif
|
||||
utmp_settime(ut);
|
||||
if (pututxline(ut) != NULL)
|
||||
|
Reference in New Issue
Block a user