diff options
| author | 2026-04-10 12:21:17 +0200 | |
|---|---|---|
| committer | 2026-04-10 12:21:17 +0200 | |
| commit | 9dfcfe8dc22233cb08aa22ba743640d8db92c4e7 (patch) | |
| tree | 12020050e429f5acac7473301838fd3895c9312b /test/plist_otest.c | |
| parent | f41b1ea67045e0c09339974d83e389972d84f166 (diff) | |
| download | libplist-9dfcfe8dc22233cb08aa22ba743640d8db92c4e7.tar.gz libplist-9dfcfe8dc22233cb08aa22ba743640d8db92c4e7.tar.bz2 | |
Fix fread() unused return values by actually handling errors
Diffstat (limited to 'test/plist_otest.c')
| -rw-r--r-- | test/plist_otest.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/test/plist_otest.c b/test/plist_otest.c index 14168f8..b2d1c94 100644 --- a/test/plist_otest.c +++ b/test/plist_otest.c @@ -66,7 +66,12 @@ int main(int argc, char *argv[]) stat(file_in, &filestats); size_in = filestats.st_size; plist_ostep = (char *) malloc(sizeof(char) * (size_in + 1)); - fread(plist_ostep, sizeof(char), size_in, iplist); + if (fread(plist_ostep, sizeof(char), size_in, iplist) != (size_t)size_in) { + printf("Failed to read input file\n"); + fclose(iplist); + free(plist_ostep); + return 3; + } fclose(iplist); plist_ostep[size_in] = 0; |
