Validate -o usage. Strictly speaking, -o only makes sense with -x,
of course, but I make an effort to accomodate GNU tar scripts that use -o with -c (with a meaning that totally contradicts SUSv2) by only issuing a benign warning message in that case.
This commit is contained in:
parent
70ad92ab84
commit
b3ea6ecd42
@ -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)
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user