(rmut): work around utmpx strangness. From Miroslav Ruda

<ruda@ics.muni.cz>


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6719 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1999-08-04 17:06:20 +00:00
parent 55c9485f34
commit cc0a3e7102

View File

@@ -1376,7 +1376,7 @@ static int addarg(struct arg_val *argv, char *val)
static void static void
rmut(void) rmut(void)
{ {
struct utmpx *utxp, utmpx; struct utmpx *utxp, utmpx, *non_save_utxp;
char *clean_tty = clean_ttyname(line); char *clean_tty = clean_ttyname(line);
/* /*
@@ -1387,8 +1387,13 @@ rmut(void)
memset(&utmpx, 0, sizeof(utmpx)); memset(&utmpx, 0, sizeof(utmpx));
strncpy(utmpx.ut_line, clean_tty, sizeof(utmpx.ut_line)); strncpy(utmpx.ut_line, clean_tty, sizeof(utmpx.ut_line));
utmpx.ut_type = LOGIN_PROCESS; utmpx.ut_type = LOGIN_PROCESS;
utxp = getutxline(&utmpx); non_save_utxp = getutxline(&utmpx);
if (utxp) { if (non_save_utxp) {
char user0;
utxp = malloc(sizeof(struct utmpx));
*utxp = *non_save_utxp;
user0 = utxp->ut_user[0];
utxp->ut_user[0] = '\0'; utxp->ut_user[0] = '\0';
utxp->ut_type = DEAD_PROCESS; utxp->ut_type = DEAD_PROCESS;
#ifdef HAVE_STRUCT_UTMPX_UT_EXIT #ifdef HAVE_STRUCT_UTMPX_UT_EXIT
@@ -1406,6 +1411,7 @@ rmut(void)
gettimeofday(&utxp->ut_tv, NULL); gettimeofday(&utxp->ut_tv, NULL);
pututxline(utxp); pututxline(utxp);
#ifdef WTMPX_FILE #ifdef WTMPX_FILE
utxp->ut_user[0] = user0;
updwtmpx(WTMPX_FILE, utxp); updwtmpx(WTMPX_FILE, utxp);
#elif defined(WTMP_FILE) #elif defined(WTMP_FILE)
/* This is a strange system with a utmpx and a wtmp! */ /* This is a strange system with a utmpx and a wtmp! */