tScream if the datafile has 0 length - ratox - FIFO based tox client
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit f057ea6ebc1f7daa848e82b24de1f3f181d19cc0
DIR parent 24f7db2f674741749c89fb666708c53e1cbe54d4
HTML Author: sin <sin@2f30.org>
Date: Tue, 23 Sep 2014 10:56:00 +0100
Scream if the datafile has 0 length
Diffstat:
M ratox.c | 6 ++++++
1 file changed, 6 insertions(+), 0 deletions(-)
---
DIR diff --git a/ratox.c b/ratox.c
t@@ -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");