aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-kbdc/raw-data.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/mds-kbdc/raw-data.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mds-kbdc/raw-data.c b/src/mds-kbdc/raw-data.c
index a1f8ec3..b0985fe 100644
--- a/src/mds-kbdc/raw-data.c
+++ b/src/mds-kbdc/raw-data.c
@@ -115,7 +115,8 @@ static char* read_file(const char* restrict pathname, size_t* restrict size)
}
/* Shrink the buffer so it is not excessively large. */
- fail_if (xxrealloc(old, content, buf_ptr, char));
+ if (buf_ptr) /* Simplest way to handle empty files: let the have the initial allocation size. */
+ fail_if (xxrealloc(old, content, buf_ptr, char));
/* Close file decriptor for the file. */
close(fd);