From 7069324a2051f61795ca66e974fddb54304c3765 Mon Sep 17 00:00:00 2001 From: nekral-guest Date: Sun, 25 May 2008 22:11:12 +0000 Subject: [PATCH] * libmisc/utmp.c (checkutmp): Change picky argument's type to bool. * libmisc/utmp.c: Use bool when possible (found_utmpx, found_utmp). * libmisc/utmp.c: Add note about unchecked return values. --- ChangeLog | 8 ++++++++ libmisc/utmp.c | 9 +++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index dcf3de4e..b6f6a365 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-05-25 Nicolas François + + * libmisc/utmp.c (checkutmp): Change picky argument's type to + bool. + * libmisc/utmp.c: Use bool when possible (found_utmpx, + found_utmp). + * libmisc/utmp.c: Add note about unchecked return values. + 2008-05-25 Nicolas François * libmisc/addgrps.c: Change type of added to bool. diff --git a/libmisc/utmp.c b/libmisc/utmp.c index f4dfbc3f..aad68340 100644 --- a/libmisc/utmp.c +++ b/libmisc/utmp.c @@ -115,7 +115,7 @@ void checkutmp (int picky) #elif defined(LOGIN_PROCESS) -void checkutmp (int picky) +void checkutmp (bool picky) { char *line; struct utmp *ut; @@ -281,7 +281,7 @@ void setutmp (const char *name, const char *line, const char *host) struct utmp *utmp, utline; struct utmpx *utmpx, utxline; pid_t pid = getpid (); - int found_utmpx = 0, found_utmp = 0; + bool found_utmpx = false, found_utmp = false; /* * The canonical device name doesn't include "/dev/"; skip it @@ -301,13 +301,13 @@ void setutmp (const char *name, const char *line, const char *host) while (utmpx = getutxent ()) { if (utmpx->ut_pid == pid) { - found_utmpx = 1; + found_utmpx = true; break; } } while (utmp = getutent ()) { if (utmp->ut_pid == pid) { - found_utmp = 1; + found_utmp = true; break; } } @@ -369,6 +369,7 @@ void setutmp (const char *name, const char *line, const char *host) pututxline (&utxline); pututline (&utline); + /* TODO: log failures */ updwtmpx (_WTMP_FILE "x", &utxline); updwtmp (_WTMP_FILE, &utline);