Commit 2e21c3c3 authored by Pontus Freyhult's avatar Pontus Freyhult
Browse files

(do_utmp_cleanup): Set ut_type to USER_PROCESS before calling getutid. Log....

(do_utmp_cleanup): Set ut_type to USER_PROCESS before calling getutid. Log. Don't modify the struct getutid uses, but make a working copy.

Rev: ChangeLog:1.470
Rev: src/unix_process.c:1.6
parent ccbcdd01
2002-03-17 Pontus <pont@it.uu.se>
* src/unix_process.c (do_utmp_cleanup): Set ut_type to
USER_PROCESS before calling getutid (neccessary on my Linux
system, and shouldn't break anything). Make a working copy to
modify. Do some logging.
2002-03-16 Niels Mller <nisse@cuckoo.hack.org>
* src/unix_user.c (exec_shell): Bugfix, fixed test for login-mode.
......
......@@ -186,20 +186,34 @@ do_utmp_cleanup(struct exit_callback *s,
struct utmp pattern;
struct utmp *utmp;
trace("unix_process.c: do_utmp_cleanup\n");
memset(&pattern, 0, sizeof(pattern));
CP(pattern.ut_line, self->line);
CP(pattern.ut_id, self->id);
/* For Linux/glibc (and possibly others), we need to set
* ut_type to find our entry */
pattern.ut_type = USER_PROCESS;
/* Rewind database */
setutent();
utmp = getutid(&pattern);
if (!utmp)
/* Entry destroyed? Do nothing. */
;
debug("unix_process.c: do_utmp_cleanup found no match\n");
else
{
/* Make a working copy of this entry that we can modify */
struct utmp wc = *utmp;
utmp = &wc;
utmp->ut_type = DEAD_PROCESS;
debug("unix_process.c: do_utmp_cleanup getutid found match\n");
#if HAVE_STRUCT_UTMP_UT_EXIT
utmp->ut_exit.e_exit = signaled ? 0 : value;
utmp->ut_exit.e_termination = signaled ? value : 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment