From owner-cvs-src@FreeBSD.ORG Sat Jun 14 06:41:32 2003 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6F7BF37B401; Sat, 14 Jun 2003 06:41:32 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1FBBF43F75; Sat, 14 Jun 2003 06:41:32 -0700 (PDT) (envelope-from trhodes@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h5EDfV0U036194; Sat, 14 Jun 2003 06:41:31 -0700 (PDT) (envelope-from trhodes@repoman.freebsd.org) Received: (from trhodes@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h5EDfVK1036193; Sat, 14 Jun 2003 06:41:31 -0700 (PDT) Message-Id: <200306141341.h5EDfVK1036193@repoman.freebsd.org> From: Tom Rhodes Date: Sat, 14 Jun 2003 06:41:31 -0700 (PDT) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/usr.bin/compress compress.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jun 2003 13:41:32 -0000 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