summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorSlava Semushin <php-coder@altlinux.ru>2009-06-06 21:53:38 +0700
committerVolker Lendecke <vl@samba.org>2009-06-06 22:45:02 +0200
commit3f5403220f2e3c0df4e436f908b97fe8cafd6616 (patch)
tree7fc1b4d3db92717fdc527e7307a70f8402c196c8 /testsuite
parent497b9e460b5defd60de89b9c5bed890f83ca86a1 (diff)
downloadsamba-3f5403220f2e3c0df4e436f908b97fe8cafd6616.tar.gz
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.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/nsswitch/getgrent_r.c2
-rw-r--r--testsuite/nsswitch/getpwent_r.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/testsuite/nsswitch/getgrent_r.c b/testsuite/nsswitch/getgrent_r.c
index 3eac8aa218d..4f1f0ce8f5e 100644
--- a/testsuite/nsswitch/getgrent_r.c
+++ b/testsuite/nsswitch/getgrent_r.c
@@ -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;
diff --git a/testsuite/nsswitch/getpwent_r.c b/testsuite/nsswitch/getpwent_r.c
index 2ba7ea96f1e..5e774911de7 100644
--- a/testsuite/nsswitch/getpwent_r.c
+++ b/testsuite/nsswitch/getpwent_r.c
@@ -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;