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:
parent
497b9e460b
commit
3f5403220f
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user