1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-14 19:24:43 +03:00

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)
This commit is contained in:
Michael Adam 2008-03-27 11:26:33 +01:00
parent 5b3f28f152
commit 5c30841fe7

View File

@ -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");
}
}
}