diff options
| author | B. Watson <urchlay@slackware.uk> | 2025-11-26 16:06:42 -0500 |
|---|---|---|
| committer | B. Watson <urchlay@slackware.uk> | 2025-11-26 16:06:42 -0500 |
| commit | 149441e5905ddacd5f771deb56a10f3b7c05f1fe (patch) | |
| tree | cc292a01e42a8061f7bbf45bcaf6212a5e0f8a12 | |
| parent | 9e53a82e90ac85164c178e9c93ca47a74cd644ff (diff) | |
| download | unalf-149441e5905ddacd5f771deb56a10f3b7c05f1fe.tar.gz | |
alf: Don't try to compress 0-byte files.
| -rw-r--r-- | src/alf.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -263,9 +263,16 @@ void crunch_file(const char *filename) { /* read in entire input, couldn't do it this way on the Atari */ input_len = fread(input_buf, 1, MAX_INPUT_SIZE - 1, in_file); + if(!feof(in_file)) { - fprintf(stderr, "%s: this file is too large; only compressing the first 16MB.\n", self); + fprintf(stderr, "%s: %s: this file is too large; only compressing the first 16MB.\n", self, filename); + } + + if(!input_len) { + fprintf(stderr, "%s: %s: can't compress a 0-byte (empty) file, skipping.\n", self, filename); + return; } + output_len = 0; fstat(fileno(in_file), &in_file_stat); /* for timestamp */ fclose(in_file); |
