diff options
| author | Nakidai <nakidai@disroot.org> | 2025-04-09 09:29:48 +0300 |
|---|---|---|
| committer | Nakidai <nakidai@disroot.org> | 2025-04-09 09:30:40 +0300 |
| commit | 54a4984f742e553db376d01f4da20772c4b16994 (patch) | |
| tree | 8030b8f249359f0e0554656f850fb14448ef302b /main.c | |
| parent | 48aca48d1f2cbe0d4f7ed1036409b7c64dc31d75 (diff) | |
| download | 3cl-54a4984f742e553db376d01f4da20772c4b16994.tar.gz 3cl-54a4984f742e553db376d01f4da20772c4b16994.zip | |
Add check if file size is 0
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/main.c b/main.c index b899c69..5e7f6ad 100644 --- a/main.c +++ b/main.c @@ -74,7 +74,7 @@ int main(int argc, char **argv) #endif /* __OpenBSD__ */ int bytes_read = fread(file.buffer, 1, file.size, f); - if (ferror(f) || bytes_read != file.size) + if (ferror(f) || bytes_read != file.size || !bytes_read) errx(1, "couldn't read %s", *argv); fclose(f); |