mirror of
https://github.com/sheumann/hush.git
synced 2024-08-20 19:29:02 +00:00
Things like 'tar -c /tmp/*' and 'tar -cO /tmp/*' where the output
filename was not explicitly specified were segfaulting. -Erik
This commit is contained in:
parent
730f826f25
commit
f3f9062ecf
@ -459,7 +459,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv,
|
||||
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);
|
||||
@ -694,6 +694,10 @@ int tar_main(int argc, char **argv)
|
||||
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("./");
|
||||
|
Loading…
Reference in New Issue
Block a user