diff options
author | Christian Hesse <mail@eworm.de> | 2013-10-31 16:28:58 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2013-10-31 16:28:58 +0100 |
commit | 77e98e61ac2768c5a19fb0384d655e78dfa72d41 (patch) | |
tree | 90db4645adbba48fe70f913387bd277fccb4a1bd | |
parent | f0ec293fee4f149e0234d0bfccdd6189145370e8 (diff) | |
download | dyndhcpd-77e98e61ac2768c5a19fb0384d655e78dfa72d41.tar.gz dyndhcpd-77e98e61ac2768c5a19fb0384d655e78dfa72d41.tar.zst |
handle return value of fread
-rw-r--r-- | dyndhcpd.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -177,7 +177,7 @@ int main(int argc, char ** argv) { /* read the template */ if ((configfile = fopen(CONFIG_TEMPLATE, "r")) == NULL) { - fprintf(stderr, "Failed reading config template.\n"); + fprintf(stderr, "Failed opening config template for reading.\n"); goto out; } fseek(configfile, 0, SEEK_END); @@ -185,7 +185,10 @@ int main(int argc, char ** argv) { fseek(configfile, 0, SEEK_SET); config = malloc(fsize + 1); - fread(config, fsize, 1, configfile); + if ((fread(config, fsize, 1, configfile)) != 1) { + fprintf(stderr, "Failed reading config template.\n"); + goto out; + } fclose(configfile); config[fsize] = 0; |