1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-27 22:50:26 +03:00

testsuite/nsswitch/get{gr,pw}ent_r.c(dump_{gr,pw}ent): fixed wrong condition.

When fopen() fails it return NULL, so condition where return value
less than zero never evaluated to truth.

Found by cppcheck.
This commit is contained in:
Slava Semushin 2009-06-06 21:53:38 +07:00 committed by Volker Lendecke
parent 497b9e460b
commit 3f5403220f
2 changed files with 2 additions and 2 deletions

View File

@ -21,7 +21,7 @@ void dump_grent(char *id)
sprintf(fname, "/tmp/getgrent_r-%s.out-%d", id, getpid());
if ((fptr = fopen(fname, "w")) < 0) {
if ((fptr = fopen(fname, "w")) == NULL) {
fprintf(stderr, "ERROR: could not open file %s: %s\n", fname,
sys_errlist[errno]);
return;

View File

@ -21,7 +21,7 @@ void dump_pwent(char *id)
sprintf(fname, "/tmp/getpwent_r-%s.out-%d", id, getpid());
if ((fptr = fopen(fname, "w")) < 0) {
if ((fptr = fopen(fname, "w")) == 0) {
fprintf(stderr, "ERROR: could not open file %s: %s\n", fname,
sys_errlist[errno]);
return;