aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/tar/bsdtar.c7
-rw-r--r--usr.bin/tar/bsdtar.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/usr.bin/tar/bsdtar.c b/usr.bin/tar/bsdtar.c
index d822851970c42..aad2ba2688dd1 100644
--- a/usr.bin/tar/bsdtar.c
+++ b/usr.bin/tar/bsdtar.c
@@ -293,6 +293,7 @@ main(int argc, char **argv)
bsdtar->option_stdout = 1;
break;
case 'o': /* SUSv2; note that GNU -o conflicts */
+ bsdtar->option_no_owner = 1;
bsdtar->extract_flags &= ~ARCHIVE_EXTRACT_OWNER;
break;
case OPTION_ONE_FILE_SYSTEM: /* -l in GNU tar */
@@ -409,6 +410,12 @@ main(int argc, char **argv)
only_mode(bsdtar, mode, "--fast-read", "xt");
if (bsdtar->option_honor_nodump)
only_mode(bsdtar, mode, "--nodump", "cru");
+ if (bsdtar->option_no_owner) {
+ only_mode(bsdtar, mode, "-o", "xc");
+ /* Warn about nonsensical -co combination, but ignore it. */
+ if (mode == 'c')
+ bsdtar_warnc(bsdtar, 0, "-o is incompatible with -c");
+ }
if (bsdtar->option_no_subdirs)
only_mode(bsdtar, mode, "-n", "cru");
if (bsdtar->option_stdout)
diff --git a/usr.bin/tar/bsdtar.h b/usr.bin/tar/bsdtar.h
index e4c1761929fa1..712a47de7fc8b 100644
--- a/usr.bin/tar/bsdtar.h
+++ b/usr.bin/tar/bsdtar.h
@@ -58,6 +58,7 @@ struct bsdtar {
char option_fast_read; /* --fast-read */
char option_honor_nodump; /* --nodump */
char option_interactive; /* -w */
+ char option_no_owner; /* -o */
char option_no_subdirs; /* -d */
char option_null; /* --null */
char option_stdout; /* -p */