summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-03-27 11:26:33 +0100
committerMichael Adam <obnox@samba.org>2008-03-27 11:46:39 +0100
commit5c30841fe7699bfa58869af110c7766a94d1f760 (patch)
treec86d2e3883d224297ba5ff469633d5c82dc6725a
parent5b3f28f1528160ac5ddcdf140371fa750590468c (diff)
downloadsamba-5c30841fe7699bfa58869af110c7766a94d1f760.tar.gz
samba-5c30841fe7699bfa58869af110c7766a94d1f760.tar.bz2
samba-5c30841fe7699bfa58869af110c7766a94d1f760.zip
libreplace: fix coverity ID 517 - untangle close from open in test/os2_delete.c
This is not a proper bug but the code is clearer now and we are tracking failure of open separate from that of close. Michael (This used to be commit 451fc9ae05f841883081a334e179cf31625a772c)
-rw-r--r--source3/lib/replace/test/os2_delete.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/source3/lib/replace/test/os2_delete.c b/source3/lib/replace/test/os2_delete.c
index c6ef180017..b45c135355 100644
--- a/source3/lib/replace/test/os2_delete.c
+++ b/source3/lib/replace/test/os2_delete.c
@@ -39,8 +39,15 @@ static void create_files(void)
int i;
for (i=0;i<NUM_FILES;i++) {
char fname[40];
+ int fd;
sprintf(fname, TESTDIR "/test%u.txt", i);
- close(open(fname, O_CREAT|O_RDWR, 0600)) == 0 || FAILED("close");
+ fd = open(fname, O_CREAT|O_RDWR, 0600);
+ if (fd < 0) {
+ FAILED("open");
+ }
+ if (close(fd) != 0) {
+ FAILED("close");
+ }
}
}