]> granicus.if.org Git - shadow/commitdiff
* libmisc/isexpired.c: Added parenthesis.
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Thu, 16 Jun 2011 21:25:36 +0000 (21:25 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Thu, 16 Jun 2011 21:25:36 +0000 (21:25 +0000)
* libmisc/env.c: Added comments.
* libmisc/env.c: Avoid implicit conversion of pointer to boolean.

ChangeLog
libmisc/env.c
libmisc/isexpired.c

index 0a62f68cf4c633d01a1329dd0c99ca63142ccaa2..d7f05c6ff4c33665c4d84864cf18e0566d9eb784 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-06-16  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * libmisc/isexpired.c: Added parenthesis.
+       * libmisc/env.c: Added comments.
+       * libmisc/env.c: Avoid implicit conversion of pointer to boolean.
+
 2011-06-16  Nicolas François  <nicolas.francois@centraliens.net>
 
        * src/su.c: environ is provided by <unistd.h>.
index 056602c46c8ef3714c402e40c512f2be5787f7e6..0b7c148fb29589f7f837129a9d8ba292e8c5f547 100644 (file)
@@ -115,6 +115,9 @@ void addenv (const char *string, /*@null@*/const char *value)
 
        n = (size_t) (cp - newstring);
 
+       /*
+        * If this environment variable is already set, change its value.
+        */
        for (i = 0; i < newenvc; i++) {
                if (   (strncmp (newstring, newenvp[i], n) == 0)
                    && (('=' == newenvp[i][n]) || ('\0' == newenvp[i][n]))) {
@@ -128,8 +131,15 @@ void addenv (const char *string, /*@null@*/const char *value)
                return;
        }
 
+       /*
+        * Otherwise, save the new environment variable
+        */
        newenvp[newenvc++] = newstring;
 
+       /*
+        * And extend the environment if needed.
+        */
+
        /*
         * Check whether newenvc is a multiple of NEWENVP_STEP.
         * If so we have to resize the vector.
@@ -143,14 +153,14 @@ void addenv (const char *string, /*@null@*/const char *value)
                size_t newsize;
 
                /*
-                * If the resize operation succeds we can
+                * If the resize operation succeeds we can
                 * happily go on, else print a message.
                 */
 
                newsize = (newenvc + NEWENVP_STEP) * sizeof (char *);
                __newenvp = (char **) realloc (newenvp, newsize);
 
-               if (__newenvp) {
+               if (NULL != __newenvp) {
                        /*
                         * If this is our current environment, update
                         * environ so that it doesn't point to some
index 416a21e4047268d95aad39cf5bba466cd3204a3a..8e8a645fb860057bc3bf48fd5e4e7b595962340e 100644 (file)
@@ -107,7 +107,7 @@ int isexpired (const struct passwd *pw, /*@null@*/const struct spwd *sp)
 
        if (   (-1 == sp->sp_lstchg)
            || (-1 == sp->sp_max)
-           || (sp->sp_max >= (10000L * DAY / SCALE))) {
+           || (sp->sp_max >= ((10000L * DAY) / SCALE))) {
                return 0;
        }