freebsd-src/usr.bin/compress
Tom Rhodes 33ffdd8115 Don't truncate the output file before making sure that we can
read at least 1 byte from the input file without problems.  This
fixes a bug in uncompress(1) that causes the accidental removal
of files that happen to have the same name as the output file,
even when the uncompression fails and is aborted, i.e.:

$ echo hello world > hello
$ touch hello.Z
$ ls -l hello*
-rw-rw-r--  1 giorgos  giorgos  12 Jun 14 13:33 hello
-rw-rw-r--  1 giorgos  giorgos   0 Jun 14 13:33 hello.Z
$ ./uncompress -f hello
uncompress: hello.Z: Inappropriate file type or format
$ ls -l hello*
-rw-rw-r--  1 giorgos  giorgos  0 Jun 14 13:33 hello.Z
$

PR:		46787
Submitted by:	keramida
2003-06-14 13:41:31 +00:00
..
doc Fix typos, mostly s/ an / a / where appropriate and a few s/an/and/ 2002-12-30 21:18:15 +00:00
compress.1 mdoc(7) police: lint. 2002-05-29 18:12:21 +00:00
compress.c Don't truncate the output file before making sure that we can 2003-06-14 13:41:31 +00:00
Makefile
zopen.3
zopen.c ANSIify function definitions to avoid a warning. 2002-07-28 15:32:17 +00:00
zopen.h