gzip: use success status when file already has compressed suffix

This matches the behavior of GNU gzip.
This commit is contained in:
Eric Biggers 2016-10-23 13:54:52 -07:00
parent b620773954
commit ed923c45d4

View File

@ -384,8 +384,7 @@ compress_file(struct libdeflate_compressor *compressor, const tchar *path,
if (!options->force && has_suffix(path, options->suffix)) { if (!options->force && has_suffix(path, options->suffix)) {
msg("%"TS": already has %"TS" suffix -- skipping", msg("%"TS": already has %"TS" suffix -- skipping",
path, options->suffix); path, options->suffix);
ret = -2; return 0;
goto out;
} }
path_nchars = tstrlen(path); path_nchars = tstrlen(path);
suffix_nchars = tstrlen(options->suffix); suffix_nchars = tstrlen(options->suffix);
@ -439,7 +438,6 @@ out_close_in:
tunlink(path); tunlink(path);
out_free_newpath: out_free_newpath:
free(newpath); free(newpath);
out:
return ret; return ret;
} }