summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tar/bsdtar.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/tar/bsdtar.c b/tar/bsdtar.c
index df0930ae..8a88f882 100644
--- a/tar/bsdtar.c
+++ b/tar/bsdtar.c
@@ -804,8 +804,14 @@ main(int argc, char **argv)
"Must specify one of -c, -r, -t, -u, -x");
/* Check boolean options only permitted in certain modes. */
- if (bsdtar->flags & OPTFLAG_AUTO_COMPRESS)
- only_mode(bsdtar, "-a", "c");
+ if (bsdtar->flags & OPTFLAG_AUTO_COMPRESS) {
+ only_mode(bsdtar, "-a", "cx");
+ if (bsdtar->mode == 'x') {
+ bsdtar->flags &= ~OPTFLAG_AUTO_COMPRESS;
+ lafe_warnc(0,
+ "Ignoring option -a in mode -x");
+ }
+ }
if (bsdtar->readdisk_flags & ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS)
only_mode(bsdtar, "--one-file-system", "cru");
if (bsdtar->flags & OPTFLAG_FAST_READ)