cvs commit: src/usr.bin/compress compress.c
Tom Rhodes
trhodes at FreeBSD.org
Sat Jun 14 06:41:32 PDT 2003
trhodes 2003/06/14 06:41:31 PDT
FreeBSD src repository
Modified files:
usr.bin/compress compress.c
Log:
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
Revision Changes Path
1.21 +17 -6 src/usr.bin/compress/compress.c
More information about the cvs-src
mailing list