]> granicus.if.org Git - shadow/commitdiff
* libmisc/utmp.c (checkutmp): Change picky argument's type to
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 25 May 2008 22:11:12 +0000 (22:11 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 25 May 2008 22:11:12 +0000 (22:11 +0000)
bool.
* libmisc/utmp.c: Use bool when possible (found_utmpx,
found_utmp).
* libmisc/utmp.c: Add note about unchecked return values.

ChangeLog
libmisc/utmp.c

index dcf3de4e4b22fc35b7d149c0d1fa8c4dc6462a60..b6f6a365686f1de47e992aecc6a8759113c430a7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-05-25  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * 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  <nicolas.francois@centraliens.net>
 
        * libmisc/addgrps.c: Change type of added to bool.
index f4dfbc3f562f9b793be35727004618bdce05653a..aad6834046b30c8a180fe970772d22cadbdf4ce8 100644 (file)
@@ -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);