Josh Triplett wrote:
> zgz's file_compress function calls gz_compress with the mtime from the
> stat buffer isb; however, if cflag == 1, file_compress will not call
> fstat to initialize that stat buffer.  Thus, "zgz -c somefile" will
> produce a different garbage timestamp each time.  -c affects the output,
> not the input, so it makes no sense to make it a requirement for running
> stat of the input file; the rest of the checks inside the if(cflag == 0)
> seem applicable in the -c case as well.

The other checks are:

- Check if the file has hard links: Only needs to be checked if the file
  is being compressed since it will be unlinked, so no need to do with
  -c.
- Check if the file has .gz suffix. gzip doesn't check this with -c
  so I think it makes sense not to.

So I think moving just the fstat call out of the if block will do.

-- 
see shy jo

Attachment: signature.asc
Description: Digital signature

Reply via email to