diff options
| author | Nakidai <nakidai@disroot.org> | 2025-04-15 15:25:44 +0300 |
|---|---|---|
| committer | Nakidai <nakidai@disroot.org> | 2025-04-15 15:25:44 +0300 |
| commit | 941b5b19de78342af7018e6d0c90a73dcd946457 (patch) | |
| tree | c50f7b6ebc4f4986fc84661c7641eaceebedd015 /main.c | |
| parent | f86c865eb27b143b36813b7ea7d26003ce107a3a (diff) | |
| download | 3cl-941b5b19de78342af7018e6d0c90a73dcd946457.tar.gz 3cl-941b5b19de78342af7018e6d0c90a73dcd946457.zip | |
Move empty file check
I find checking file for emptyness in tokenizer.c rather than just after reading more correct as file is read without any errors Also, warning won't be printed with -v anymore
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/main.c b/main.c index 301c59b..434d08e 100644 --- a/main.c +++ b/main.c @@ -72,9 +72,7 @@ int main(int argc, char **argv) #endif /* __OpenBSD__ */ int bytes_read = fread(file.buffer, 1, file.size, f); - if (!bytes_read) - return (verbose ? warnx("reading empty file") : 0, 0); - else if (ferror(f) || bytes_read != file.size) + if (ferror(f) || bytes_read != file.size) errx(1, "couldn't read %s", *argv); fclose(f); |