From f057ea6ebc1f7daa848e82b24de1f3f181d19cc0 Mon Sep 17 00:00:00 2001 From: sin Date: Tue, 23 Sep 2014 10:56:00 +0100 Subject: Scream if the datafile has 0 length --- ratox.c | 6 ++++++ 1 file changed, 6 insertions(+) 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"); -- cgit v1.2.3