summaryrefslogtreecommitdiffstats
path: root/usr.bin/compress
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2002-05-17 00:58:07 +0000
committertjr <tjr@FreeBSD.org>2002-05-17 00:58:07 +0000
commit37d5dd60af7c1ef1e84a4ba16dfb2919a6ec5e51 (patch)
tree7d92b05fb08d593b7c04d6f0b25df8582ba83016 /usr.bin/compress
parent3c3efb7e1988761721dc0888e970470a6e3d78f1 (diff)
downloadFreeBSD-src-37d5dd60af7c1ef1e84a4ba16dfb2919a6ec5e51.zip
FreeBSD-src-37d5dd60af7c1ef1e84a4ba16dfb2919a6ec5e51.tar.gz
Use exit status 2 to indicate that the file was not compressed because
its size would not be reduced (SUSv3).
Diffstat (limited to 'usr.bin/compress')
-rw-r--r--usr.bin/compress/compress.17
-rw-r--r--usr.bin/compress/compress.c1
2 files changed, 8 insertions, 0 deletions
diff --git a/usr.bin/compress/compress.1 b/usr.bin/compress/compress.1
index 9b6e4c0..cb69bcb 100644
--- a/usr.bin/compress/compress.1
+++ b/usr.bin/compress/compress.1
@@ -150,6 +150,13 @@ coding (as used in the historical command compact), and takes less
time to compute.
.Sh DIAGNOSTICS
.Ex -std compress uncompress
+.Pp
+The
+.Nm compress
+utility exits 2 if attempting to compress the file would not reduce its size
+and the
+.Fl f
+option was not specified.
.Sh SEE ALSO
.Xr gunzip 1 ,
.Xr gzexe 1 ,
diff --git a/usr.bin/compress/compress.c b/usr.bin/compress/compress.c
index bcdfd69..b69422c 100644
--- a/usr.bin/compress/compress.c
+++ b/usr.bin/compress/compress.c
@@ -249,6 +249,7 @@ compress(in, out, bits)
if (!force && sb.st_size >= isb.st_size) {
if (verbose)
(void)printf("%s: file would grow; left unmodified\n", in);
+ eval = 2;
if (unlink(out))
cwarn("%s", out);
goto err;
OpenPOWER on IntegriCloud