1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

lib: Fix CID 1034836 Resource leak

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
This commit is contained in:
Volker Lendecke 2015-05-03 09:45:33 +00:00
parent 607301a843
commit 19b28ee828

View File

@ -69,19 +69,23 @@ static int test_ftruncate(void)
}
if (ftruncate(fd, size) != 0) {
printf("failure: ftruncate [\n%s\n]\n", strerror(errno));
close(fd);
return false;
}
if (fstat(fd, &st) != 0) {
printf("failure: ftruncate [\nfstat failed - %s\n]\n", strerror(errno));
close(fd);
return false;
}
if (st.st_size != size) {
printf("failure: ftruncate [\ngave wrong size %d - expected %d\n]\n",
(int)st.st_size, size);
close(fd);
return false;
}
unlink(TESTFILE);
printf("success: ftruncate\n");
close(fd);
return true;
}