Commit Graph

21 Commits

Author SHA1 Message Date
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
David Malone
47e9e6a168 ANSIify function definitions to avoid a warning. 2002-07-28 15:32:17 +00:00
Tim J. Robbins
b477159065 As required by SUSv3, a file argument of "-" causes standard input
to be compressed/decompressed to standard output.
2002-05-17 01:42:43 +00:00
Tim J. Robbins
783b4710d3 Compression ratio statistics should be written to stderr instead of stdout. 2002-05-17 01:25:51 +00:00
Tim J. Robbins
6c1b63bb06 Use exit status 2 to indicate that the file was not compressed because
its size would not be reduced (SUSv3).
2002-05-17 00:58:07 +00:00
Warner Losh
7ddea7b836 unifdef -D__STDC__ 2002-03-23 23:19:00 +00:00
Warner Losh
f1bb2cd2aa remove __P 2002-03-22 01:22:50 +00:00
David Malone
9f5b04e925 Style improvements recommended by Bruce as a follow up to some
of the recent WARNS commits. The idea is:

1) FreeBSD id tags should follow vendor tags.
2) Vendor tags should not be compiled (though copyrights probably should).
3) There should be no blank line between including cdefs and __FBSDIF.
2001-12-10 21:13:08 +00:00
Mark Murray
546c7f6629 Use __FBSDID().
Use a better choice than size_t for vertain variables.
Fix some comment alignment.
2001-12-02 23:58:38 +00:00
Mark Murray
cb08795bb0 WARNS=2 fix and 'register' removal. 2001-12-02 13:31:22 +00:00
Kris Kennaway
6209021ebd Mark some functions as __printflike()
MFC after:	1 week
2001-07-05 09:54:59 +00:00
Garrett Wollman
eb2fc78027 Don't depend on <sys/stat.h> bogusly including <sys/time.h> (and thereby
<time.h>).
2000-10-10 01:50:26 +00:00
Tim Vanderhoek
da94aa4ef2 From PR submitter:
compress uses setfile() to make flags, ownership and mode of the output
 the same as those of the original. However, if the filesystem holding the
 output file doesn't support these operations, compress prints a warning.
 This bites a bit with NFS directories, which always fail the chflags()
 operation. If the file system doesn't support the operation, then the
 flags data wasn't valid on the original file anyway, so the warning is
 spurious.

Submitted by:	bin/16981 (Peter Edwards <peter.edwards@ireland.com>)
2000-05-16 04:58:34 +00:00
Philippe Charnier
fae643c579 Add DIAGNOSTICS section name. Spelling 2000-03-26 15:10:37 +00:00
Archie Cobbs
fa146c5335 Tweaks to allow compiling -Wall (mostly adding "const" to char rcsid[]). 1998-12-06 22:58:23 +00:00
Bruce Evans
d52ae8190d Fixed previous commit to actually work. The wrong variable was initialized
earlier (with style bugs of course), so zcat was an alias for uncompress
instead of `uncompress -c'.
1998-10-21 11:48:39 +00:00
Mike Smith
7c0704e446 Behave like zcat if invoked as zcat. We don't install as zcat; this just
makes us more useful in a tight environment.

Submitted by:	Wilfredo Sanchez <wsanchez@apple.com>
1998-10-20 06:13:57 +00:00
Warner Losh
1c8af87873 compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-29 04:34:07 +00:00
Bruce Evans
1f36dc1f9e Finished adjustments for cleaning up declaration of zopen(). Moving the
declaration from <stdio.h> to "zopen.h" left it undeclared here.
1996-09-05 18:15:43 +00:00
Rodney W. Grimes
7799f52a32 Remove trailing whitespace. 1995-05-30 06:41:30 +00:00
Rodney W. Grimes
9b50d90275 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00