Date: Sat, 14 Jun 2003 06:41:31 -0700 (PDT) From: Tom Rhodes <trhodes@FreeBSD.org> To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/usr.bin/compress compress.c Message-ID: <200306141341.h5EDfVK1036193@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200306141341.h5EDfVK1036193>
