From: Mark Andrews Date: Sat, 23 Jun 2012 08:21:52 +0000 (+1000) Subject: check fwrite results X-Git-Tag: v9.10.0a1~1086 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=abeb649619d29c1a96d00bda2ec5c025b68dd765;p=thirdparty%2Fbind9.git check fwrite results --- diff --git a/lib/dns/tests/rbt_test.c b/lib/dns/tests/rbt_test.c index ac58b971f7e..1611091586c 100644 --- a/lib/dns/tests/rbt_test.c +++ b/lib/dns/tests/rbt_test.c @@ -115,8 +115,13 @@ write_data(FILE *file, unsigned char *datap, isc_uint32_t serial) { : (char *)(where + sizeof(data_holder_t))); ret = fwrite(&temp, sizeof(data_holder_t), 1, file); - if (data->len > 0) + if (ret != 1) + return (ISC_R_FAILURE); + if (data->len > 0) { ret = fwrite(data->data, data->len, 1, file); + if (ret != 1) + return (ISC_R_FAILURE); + } return (ISC_R_SUCCESS); }