git.samba.org
/
metze
/
samba
/
wip.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2c9ee20
)
libreplace: fix coverity ID 517 - untangle close from open in test/os2_delete.c
author
Michael Adam
<obnox@samba.org>
Thu, 27 Mar 2008 10:26:33 +0000
(11:26 +0100)
committer
Michael Adam
<obnox@samba.org>
Thu, 27 Mar 2008 10:56:51 +0000
(11:56 +0100)
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
)
source4/lib/replace/test/os2_delete.c
patch
|
blob
|
history
diff --git
a/source4/lib/replace/test/os2_delete.c
b/source4/lib/replace/test/os2_delete.c
index c6ef180017897daa1f770ec4f953eb2dcf1e5787..b45c135355a0a7be5f339e4225f1009ea2a0a943 100644
(file)
--- 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");
+ }
}
}