diff options
author | Michael Adam <obnox@samba.org> | 2008-03-27 11:26:33 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2008-03-27 11:56:51 +0100 |
commit | 4ae4692bc6c6da15483a6f4a3363cdc23121efc7 (patch) | |
tree | 711af5a080771f190aaabd6aac719d8325e69b06 /source | |
parent | 9342c4f5ff2be16c9771fd07fbec87076af2e681 (diff) | |
download | samba-4ae4692bc6c6da15483a6f4a3363cdc23121efc7.tar.gz |
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
Diffstat (limited to 'source')
-rw-r--r-- | source/lib/replace/test/os2_delete.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source/lib/replace/test/os2_delete.c b/source/lib/replace/test/os2_delete.c index c6ef1800178..b45c135355a 100644 --- a/source/lib/replace/test/os2_delete.c +++ b/source/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"); + } } } |