From ca4c76db14887f9e36ea00afd244851a4e6cdaf8 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Sat, 11 Jan 2014 16:41:03 +0900 Subject: [PATCH] elm prefs cc - fix failed lseek handling on compile --- src/bin/elm_prefs_cc_parse.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/bin/elm_prefs_cc_parse.c b/src/bin/elm_prefs_cc_parse.c index 1028e5e..ce649e7 100644 --- a/src/bin/elm_prefs_cc_parse.c +++ b/src/bin/elm_prefs_cc_parse.c @@ -695,6 +695,12 @@ compile(void) DBG("Opening \"%s\" for input", file_in); size = lseek(fd, 0, SEEK_END); + if (size <= 0) + { + ERR("lseek failed"); + close(fd); + return; + } lseek(fd, 0, SEEK_SET); data = malloc(size); if (data && (read(fd, data, size) == size)) -- 2.7.4