From f79d9b9310cf9e6c33b42d91aa11ceb51df3135e Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 18 Jan 2023 10:42:53 +0100 Subject: gpgtar: Make --status-fd option for fds > 2 work * tools/gpgtar-create.c (gpgtar_create): Do not close the status_fd in spawn. * tools/gpgtar-extract.c (gpgtar_extract): Ditto. * tools/gpgtar-list.c (gpgtar_list): Ditto. -- Note that this fix does not handle file descripotors passed via the --gpg-args options. GnuPG-bug-id: 6348 --- tools/gpgtar-extract.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tools/gpgtar-extract.c') diff --git a/tools/gpgtar-extract.c b/tools/gpgtar-extract.c index f96887f40..bc2e672de 100644 --- a/tools/gpgtar-extract.c +++ b/tools/gpgtar-extract.c @@ -369,6 +369,7 @@ gpgtar_extract (const char *filename, int decrypt) { strlist_t arg; ccparray_t ccp; + int except[2] = { -1, -1 }; const char **argv; ccparray_init (&ccp, 0); @@ -382,6 +383,7 @@ gpgtar_extract (const char *filename, int decrypt) snprintf (tmpbuf, sizeof tmpbuf, "--status-fd=%d", opt.status_fd); ccparray_put (&ccp, tmpbuf); + except[0] = opt.status_fd; } if (opt.with_log) { @@ -408,7 +410,8 @@ gpgtar_extract (const char *filename, int decrypt) goto leave; } - err = gnupg_spawn_process (opt.gpg_program, argv, NULL, + err = gnupg_spawn_process (opt.gpg_program, argv, + except[0] == -1? NULL : except, ((filename? 0 : GNUPG_SPAWN_KEEP_STDIN) | GNUPG_SPAWN_KEEP_STDERR), NULL, &stream, NULL, &pid); -- cgit v1.2.3