From: Mark Andrews Date: Thu, 22 Aug 2019 03:53:31 +0000 (+1000) Subject: check that open() succeeded X-Git-Tag: v9.15.4~25^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=510306c6541761041d1be4a7235fa9b91ab9bdea;p=thirdparty%2Fbind9.git check that open() succeeded --- diff --git a/lib/dns/tests/rbt_serialize_test.c b/lib/dns/tests/rbt_serialize_test.c index af450b2f3da..06f7006bd0f 100644 --- a/lib/dns/tests/rbt_serialize_test.c +++ b/lib/dns/tests/rbt_serialize_test.c @@ -332,6 +332,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); @@ -392,6 +393,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);