summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsin <sin@2f30.org>2014-09-23 10:56:00 +0100
committersin <sin@2f30.org>2014-09-23 10:56:00 +0100
commitf057ea6ebc1f7daa848e82b24de1f3f181d19cc0 (patch)
treeee579d0efc3fa7b12527272320ffb23bb5d2db1e
parent24f7db2f674741749c89fb666708c53e1cbe54d4 (diff)
Scream if the datafile has 0 length
-rw-r--r--ratox.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ratox.c b/ratox.c
index 0523088..fd3504c 100644
--- a/ratox.c
+++ b/ratox.c
@@ -588,6 +588,12 @@ dataload(void)
sz = lseek(fd, 0, SEEK_END);
lseek(fd, 0, SEEK_SET);
+ if (sz == 0) {
+ fprintf(stderr, "%s seems to be corrupt\n",
+ DATAFILE);
+ exit(EXIT_FAILURE);
+ }
+
data = malloc(sz);
if (!data) {
perror("malloc");