]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
check fwrite results
authorMark Andrews <marka@isc.org>
Sat, 23 Jun 2012 08:21:52 +0000 (18:21 +1000)
committerMark Andrews <marka@isc.org>
Sat, 23 Jun 2012 08:21:52 +0000 (18:21 +1000)
lib/dns/tests/rbt_test.c

index ac58b971f7ed4e130d7aa3417a5b80ed36d2d3de..1611091586ccd71099b5b7c0e423e0f0c7720793 100644 (file)
@@ -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);
 }