summaryrefslogtreecommitdiff
path: root/source4/lib/replace/test/os2_delete.c
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:56:51 +0100
commit35f33a26404866c676285356a17e42b56523008a (patch)
tree1326a18c173d8eef1af492a825a9fa075ce26958 /source4/lib/replace/test/os2_delete.c
parent2c9ee20f15ef0f55bf4e2516ba498cc6d9403b71 (diff)
downloadsamba-35f33a26404866c676285356a17e42b56523008a.tar.gz
samba-35f33a26404866c676285356a17e42b56523008a.tar.bz2
samba-35f33a26404866c676285356a17e42b56523008a.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 4ae4692bc6c6da15483a6f4a3363cdc23121efc7)
Diffstat (limited to 'source4/lib/replace/test/os2_delete.c')
-rw-r--r--source4/lib/replace/test/os2_delete.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/source4/lib/replace/test/os2_delete.c b/source4/lib/replace/test/os2_delete.c
index c6ef180017..b45c135355 100644
--- a/source4/lib/replace/test/os2_delete.c
+++ b/source4/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");
+ }
}
}