diff options
author | Florian Pritz <bluewind@xinu.at> | 2012-01-25 12:11:31 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2012-01-25 12:11:31 +0100 |
commit | 3e32e2ce18fba5a52d2d1ddbaf34b6800f644f03 (patch) | |
tree | c2bc126241a0c09605724409eec32e06d36d7595 | |
parent | bcb55411af16c89a633c2e7c8e04769766a9fec7 (diff) |
fb-helper.c: catch read() errors
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r-- | fb-helper.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fb-helper.c b/fb-helper.c index 71ae0ab..6abf81d 100644 --- a/fb-helper.c +++ b/fb-helper.c @@ -53,7 +53,13 @@ int load_file(const char *fn, char **data, size_t *data_size) perror("load_file"); return 1; } + *data_size += fread(*data + *data_size, sizeof(char), buf_size, fp); + + if (ferror(fp)) { + perror("load_file"); + return 1; + } } fclose(fp); |