check that open() succeeded

(cherry picked from commit 510306c654)
This commit is contained in:
Mark Andrews 2019-08-22 13:53:31 +10:00
parent f54f73d063
commit 768fb45660

View file

@ -335,6 +335,7 @@ serialize_test(void **state) {
* Map in the whole file in one go
*/
fd = open("zone.bin", O_RDWR);
assert_int_not_equal(fd, -1);
isc_file_getsizefd(fd, &filesize);
base = mmap(NULL, filesize, PROT_READ|PROT_WRITE,
MAP_FILE|MAP_PRIVATE, fd, 0);
@ -395,6 +396,7 @@ deserialize_corrupt_test(void **state) {
dns_rbt_t *rbt_deserialized = NULL;
fd = open("zone.bin", O_RDWR);
assert_int_not_equal(fd, -1);
isc_file_getsizefd(fd, &filesize);
base = mmap(NULL, filesize, PROT_READ|PROT_WRITE,
MAP_FILE|MAP_PRIVATE, fd, 0);