diff options
| -rw-r--r-- | ui-snapshot.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/ui-snapshot.c b/ui-snapshot.c index 07cc944..47432bd 100644 --- a/ui-snapshot.c +++ b/ui-snapshot.c | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | /* ui-snapshot.c: generate snapshot of a commit | 1 | /* ui-snapshot.c: generate snapshot of a commit |
| 2 | * | 2 | * |
| 3 | * Copyright (C) 2006 Lars Hjemli | 3 | * Copyright (C) 2006 Lars Hjemli |
| 4 | * Copyright (C) 2012 Jason A. Donenfeld <Jason@zx2c4.com> | ||
| 4 | * | 5 | * |
| 5 | * Licensed under GNU General Public License v2 | 6 | * Licensed under GNU General Public License v2 |
| 6 | * (see COPYING for full license text) | 7 | * (see COPYING for full license text) |
| @@ -10,15 +11,13 @@ | |||
| 10 | #include "html.h" | 11 | #include "html.h" |
| 11 | #include "ui-shared.h" | 12 | #include "ui-shared.h" |
| 12 | 13 | ||
| 13 | static int write_compressed_tar_archive(struct archiver_args *args,const char *filter) | 14 | static int write_compressed_tar_archive(struct archiver_args *args, char *filter_argv[]) |
| 14 | { | 15 | { |
| 15 | int rv; | 16 | int rv; |
| 16 | struct cgit_filter f; | 17 | struct cgit_filter f; |
| 17 | 18 | ||
| 18 | f.cmd = xstrdup(filter); | 19 | f.cmd = filter_argv[0]; |
| 19 | f.argv = malloc(2 * sizeof(char *)); | 20 | f.argv = filter_argv; |
| 20 | f.argv[0] = f.cmd; | ||
| 21 | f.argv[1] = NULL; | ||
| 22 | cgit_open_filter(&f); | 21 | cgit_open_filter(&f); |
| 23 | rv = write_tar_archive(args); | 22 | rv = write_tar_archive(args); |
| 24 | cgit_close_filter(&f); | 23 | cgit_close_filter(&f); |
| @@ -27,17 +26,20 @@ static int write_compressed_tar_archive(struct archiver_args *args,const char *f | |||
| 27 | 26 | ||
| 28 | static int write_tar_gzip_archive(struct archiver_args *args) | 27 | static int write_tar_gzip_archive(struct archiver_args *args) |
| 29 | { | 28 | { |
| 30 | return write_compressed_tar_archive(args,"gzip"); | 29 | char *argv[] = { "gzip", "-n", NULL }; |
| 30 | return write_compressed_tar_archive(args, argv); | ||
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | static int write_tar_bzip2_archive(struct archiver_args *args) | 33 | static int write_tar_bzip2_archive(struct archiver_args *args) |
| 34 | { | 34 | { |
| 35 | return write_compressed_tar_archive(args,"bzip2"); | 35 | char *argv[] = { "bzip2", NULL }; |
| 36 | return write_compressed_tar_archive(args, argv); | ||
| 36 | } | 37 | } |
| 37 | 38 | ||
| 38 | static int write_tar_xz_archive(struct archiver_args *args) | 39 | static int write_tar_xz_archive(struct archiver_args *args) |
| 39 | { | 40 | { |
| 40 | return write_compressed_tar_archive(args,"xz"); | 41 | char *argv[] = { "xz", NULL }; |
| 42 | return write_compressed_tar_archive(args, argv); | ||
| 41 | } | 43 | } |
| 42 | 44 | ||
| 43 | const struct cgit_snapshot_format cgit_snapshot_formats[] = { | 45 | const struct cgit_snapshot_format cgit_snapshot_formats[] = { |
