]> granicus.if.org Git - shadow/commitdiff
* libmisc/myname.c: Avoid assignments in comparisons.
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 25 May 2008 22:15:28 +0000 (22:15 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 25 May 2008 22:15:28 +0000 (22:15 +0000)
* libmisc/myname.c: Avoid implicit conversion of pointers / chars
to booleans.
* libmisc/myname.c: Add brackets.

ChangeLog
libmisc/myname.c

index b6f6a365686f1de47e992aecc6a8759113c430a7..81581ea28843ba3e6327764d68a34c90793639cc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-05-25  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * libmisc/myname.c: Avoid assignments in comparisons.
+       * libmisc/myname.c: Avoid implicit conversion of pointers / chars
+       to booleans.
+       * libmisc/myname.c: Add brackets.
+
 2008-05-25  Nicolas François  <nicolas.francois@centraliens.net>
 
        * libmisc/utmp.c (checkutmp): Change picky argument's type to
index ff6d17ba20bf84b545bfe5b57fe2fabca7c28765..23464172136ff5f90cc388cfcc95cd30b2ad7db4 100644 (file)
@@ -57,8 +57,12 @@ struct passwd *get_my_pwent (void)
         * XXX - when running from su, will return the current user (not
         * the original user, like getlogin() does).  Does this matter?
         */
-       if (cp && *cp && (pw = xgetpwnam (cp)) && pw->pw_uid == ruid)
-               return pw;
+       if ((NULL !=cp) && ('\0' != *cp)) {
+               pw = xgetpwnam (cp);
+               if ((NULL != pw) && (pw->pw_uid == ruid)) {
+                       return pw;
+               }
+       }
 
        return xgetpwuid (ruid);
 }