From bc5f9fb0a39ae18d469a08bde515771da34bbeb9 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Thu, 25 Jan 2001 14:44:01 +0000 Subject: [PATCH] Don't allow `--stdout' when compressing. committer: mfx 980433841 +0000 --- src/file.h | 2 ++ src/main.cpp | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/file.h b/src/file.h index dc49fe1e..f9181e94 100644 --- a/src/file.h +++ b/src/file.h @@ -122,10 +122,12 @@ public: // FIXME - these won't work when using the `--stdout' option virtual void seek(off_t off, int whence) { + assert(!opt->to_stdout); super::seek(off,whence); } virtual void rewrite(const void *buf, int len) { + assert(!opt->to_stdout); write(buf, len); bytes_written -= len; // restore } diff --git a/src/main.cpp b/src/main.cpp index 5fbd2e74..e7a12594 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -229,6 +229,11 @@ void check_options(int i, int argc) opt->backup = 1; check_not_both(opt->to_stdout, opt->output_name != NULL, "--stdout", "-o"); + if (opt->to_stdout && opt->cmd == CMD_COMPRESS) + { + fprintf(stderr,"%s: cannot use `--stdout' when compressing\n", argv0); + e_usage(); + } if (opt->to_stdout || opt->output_name) { if (i + 1 != argc)