* libmisc/myname.c: Avoid assignments in comparisons.

* libmisc/myname.c: Avoid implicit conversion of pointers / chars
	to booleans.
	* libmisc/myname.c: Add brackets.
This commit is contained in:
nekral-guest 2008-05-25 22:15:28 +00:00
parent 639b2bd8e5
commit a2982f0d4e
2 changed files with 13 additions and 2 deletions

View File

@ -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

View 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);
}