mirror of
https://github.com/topjohnwu/selinux.git
synced 2024-11-23 11:39:50 +00:00
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>
This commit is contained in:
parent
1e4e7f6a12
commit
d1a34d3f1d
@ -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 New Issue
Block a user