secilc.c: Don't fail if input file is empty
fread(3) returns zero if |size| is zero. This confuses secilc, and causes it to fail with a "Failure reading file" error, even though there is no error. Add a shortcut that closes and skips an input file if file size is zero. Signed-off-by: Yi-Yo Chiang <yochiang@google.com> Change-Id: I9832c62ebf6f716235e871b5e29b0fd70c94b453
This commit is contained in:
parent
0c40b2bbcf
commit
ff3c99978a
1 changed files with 6 additions and 0 deletions
|
@ -268,6 +268,12 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
file_size = filedata.st_size;
|
||||
|
||||
if (!file_size) {
|
||||
fclose(file);
|
||||
file = NULL;
|
||||
continue;
|
||||
}
|
||||
|
||||
buffer = malloc(file_size);
|
||||
rc = fread(buffer, file_size, 1, file);
|
||||
if (rc != 1) {
|
||||
|
|
Loading…
Reference in a new issue