Avoid assignments in comparisons.

This commit is contained in:
nekral-guest 2007-12-31 15:30:29 +00:00
parent ce4e74c1b9
commit 4c9686df0c
2 changed files with 6 additions and 2 deletions

View File

@ -5,6 +5,7 @@
* src/chsh.c: Before pam_end(), the return value of the previous * src/chsh.c: Before pam_end(), the return value of the previous
pam API was already checked. No need to validate it again. pam API was already checked. No need to validate it again.
* src/chsh.c: Avoid implicit brackets. * src/chsh.c: Avoid implicit brackets.
* src/chsh.c: Avoid assignments in comparisons.
2007-12-31 Nicolas François <nicolas.francois@centraliens.net> 2007-12-31 Nicolas François <nicolas.francois@centraliens.net>

View File

@ -153,11 +153,14 @@ static int check_shell (const char *sh)
} }
endusershell (); endusershell ();
#else #else
if ((fp = fopen (SHELLS_FILE, "r")) == (FILE *) 0) fp = fopen (SHELLS_FILE, "r");
if (NULL == fp) {
return 0; return 0;
}
while (fgets (buf, sizeof (buf), fp)) { while (fgets (buf, sizeof (buf), fp)) {
if ((cp = strrchr (buf, '\n'))) { cp = strrchr (buf, '\n');
if (NULL != cp) {
*cp = '\0'; *cp = '\0';
} }