elm prefs cc - fix failed lseek handling on compile

This commit is contained in:
Carsten Haitzler 2014-01-11 16:41:03 +09:00
parent f21cb31770
commit 380285b7d9
1 changed files with 6 additions and 0 deletions

View File

@ -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))