error_msg_and_die("Cowardly refusing to create an empty archive");
/* Open the tar file for writing. */
- if (!strcmp(tarName, "-"))
+ if (tarName == NULL || !strcmp(tarName, "-"))
tbInfo.tarFd = fileno(stdout);
else
tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644);
optind++;
}
+ if (src_filename == NULL) {
+ extract_function |= extract_to_stdout;
+ }
+
if (extract_function & (extract_list | extract_all_to_fs)) {
if (dst_prefix == NULL) {
dst_prefix = xstrdup("./");