X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=archive.c;h=96b62d4309a3bd4198bb035f266a1326fed61d10;hb=98e1a4186acd4b71da1daae5c522cb6ac6d1d904;hp=c6aea8358f5b632ee11cb102c1ec1b6c2b317835;hpb=e7cf1da70f1bbb477614547ca2874392c9d37862;p=git.git diff --git a/archive.c b/archive.c index c6aea8358..96b62d430 100644 --- a/archive.c +++ b/archive.c @@ -239,19 +239,6 @@ static void parse_treeish_arg(const char **argv, ar_args->time = archive_time; } -static void create_output_file(const char *output_file) -{ - int output_fd = open(output_file, O_CREAT | O_WRONLY | O_TRUNC, 0666); - if (output_fd < 0) - die("could not create archive file: %s ", output_file); - if (output_fd != 1) { - if (dup2(output_fd, 1) < 0) - die("could not redirect output"); - else - close(output_fd); - } -} - #define OPT__COMPR(s, v, h, p) \ { OPTION_SET_INT, (s), NULL, (v), NULL, (h), \ PARSE_OPT_NOARG | PARSE_OPT_NONEG, NULL, (p) } @@ -306,13 +293,12 @@ static int parse_archive_args(int argc, const char **argv, die("Unexpected option --remote"); if (exec) die("Option --exec can only be used together with --remote"); + if (output) + die("Unexpected option --output"); if (!base) base = ""; - if (output) - create_output_file(output); - if (list) { for (i = 0; i < ARRAY_SIZE(archivers); i++) printf("%s\n", archivers[i].name);