diff options
author | Werner Koch <wk@gnupg.org> | 2023-01-30 15:23:38 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2023-01-30 15:23:38 +0100 |
commit | f84264e8acf742793c73ce78491cab61fac37051 (patch) | |
tree | 68902b576410ecdee55a5c7411a2af0ef9958574 /tools/gpgtar.c | |
parent | gpgtar: Fix parent directory creation bug (diff) | |
download | gnupg2-f84264e8acf742793c73ce78491cab61fac37051.tar.xz gnupg2-f84264e8acf742793c73ce78491cab61fac37051.zip |
gpgtar: Emit progress status lines in create mode.
* tools/gpgtar.h (opt): Add field status_stream.
* tools/gpgtar.c (main): Set status_stream.
* tools/gpgtar-create.c (global_header_count): Rename to
global_total_files.
(global_written_files): New.
(global_total_data, global_written_data): New.
(struct scanctrl_s): Add field file_count.
(write_progress): New.
(write_file): Add arg skipped_open. Don't bail out immediatly on open
error. Write progress lines.
(gpgtar_create): Write progress lines. Print info aout skipped files.
--
GnuPG-bug-id: 6363
Diffstat (limited to 'tools/gpgtar.c')
-rw-r--r-- | tools/gpgtar.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/gpgtar.c b/tools/gpgtar.c index b412f3ffb..5d16b70a7 100644 --- a/tools/gpgtar.c +++ b/tools/gpgtar.c @@ -491,6 +491,32 @@ main (int argc, char **argv) log_info (_("NOTE: '%s' is not considered an option\n"), argv[i]); } + /* Set status stream for our own use of --status-fd. The original + * status fd is passed verbatim to gpg. */ + if (opt.status_fd) + { + int fd = translate_sys2libc_fd_int (opt.status_fd, 1); + + if (!gnupg_fd_valid (fd)) + log_fatal ("status-fd is invalid: %s\n", strerror (errno)); + + if (fd == 1) + opt.status_stream = es_stdout; + else if (fd == 2) + opt.status_stream = es_stderr; + else + { + opt.status_stream = es_fdopen (fd, "w"); + if (opt.status_stream) + es_setvbuf (opt.status_stream, NULL, _IOLBF, 0); + } + if (!opt.status_stream) + { + log_fatal ("can't open fd %d for status output: %s\n", + fd, strerror (errno)); + } + } + if (! opt.gpg_program) opt.gpg_program = gnupg_module_name (GNUPG_MODULE_NAME_GPG); |