]> granicus.if.org Git - shadow/commitdiff
* libmisc/setugid.c (setup_uid_gid): The is_console argument is now a bool.
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 25 May 2008 23:42:39 +0000 (23:42 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 25 May 2008 23:42:39 +0000 (23:42 +0000)
* libmisc/setugid.c: Avoid implicit conversion of integers / pointers to booleans.
* libmisc/setugid.c: Add brackets.

ChangeLog
libmisc/setugid.c

index 46773ec0d7741a1e51ffa75415793a7af12b693e..ad97a96e3c2606dfcafd106ae5d68add1e450fa9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,6 @@
 2008-05-26  Nicolas François  <nicolas.francois@centraliens.net>
 
-       * libmisc/setugid.c (setup_uid_gid): The is_console argument is no
+       * libmisc/setugid.c (setup_uid_gid): The is_console argument is now
        a bool.
        * libmisc/setugid.c: Avoid implicit conversion of integers /
        pointers to booleans.
index 603854362894cec17b4dc9d8a2bb27d7d4b8edf1..8d97924e79fac4ce011389ae3e33a0517eb0ff2e 100644 (file)
@@ -82,7 +82,7 @@ int change_uid (const struct passwd *info)
        /*
         * Set the real UID to the UID value in the password file.
         */
-       if (setuid (info->pw_uid)) {
+       if (setuid (info->pw_uid) != 0) {
                perror ("setuid");
                SYSLOG ((LOG_ERR, "bad user ID `%d' for user `%s': %m\n",
                         (int) info->pw_uid, info->pw_name));
@@ -103,7 +103,7 @@ int change_uid (const struct passwd *info)
  *     Returns 0 on success, or -1 on failure.
  */
 
-int setup_uid_gid (const struct passwd *info, int is_console)
+int setup_uid_gid (const struct passwd *info, bool is_console)
 {
        if (setup_groups (info) < 0)
                return -1;
@@ -112,8 +112,9 @@ int setup_uid_gid (const struct passwd *info, int is_console)
        if (is_console) {
                char *cp = getdef_str ("CONSOLE_GROUPS");
 
-               if (cp && add_groups (cp))
+               if ((NULL != cp) && (add_groups (cp) != 0)) {
                        perror ("Warning: add_groups");
+               }
        }
 #endif                         /* HAVE_INITGROUPS */