Disallow --one-top-level=''.

* src/tar.c (decode_options): Do not accept an empty string
as a relative file name.
This commit is contained in:
Paul Eggert
2026-04-07 11:05:23 -07:00
parent 3e4279db96
commit b4fc9ca136

View File

@@ -2688,7 +2688,9 @@ decode_options (int argc, char **argv)
"please set it explicitly with --one-top-level=DIR"));
}
if (one_top_level_dir && !IS_RELATIVE_FILE_NAME (one_top_level_dir))
if (one_top_level_dir
&& ! (*one_top_level_dir
&& IS_RELATIVE_FILE_NAME (one_top_level_dir)))
paxusage(_("--one-top-level=DIR must use a relative file name"));
}