1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

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
This commit is contained in:
Werner Koch 2023-01-19 16:13:35 +01:00
parent 841c691128
commit 417e8588f3
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
3 changed files with 15 additions and 3 deletions

View file

@ -1151,6 +1151,7 @@ gpgtar_create (char **inpattern, const char *files_from, int null_names,
{
strlist_t arg;
ccparray_t ccp;
int except[2] = { -1, -1 };
const char **argv;
/* '--encrypt' may be combined with '--symmetric', but 'encrypt'
@ -1174,6 +1175,7 @@ gpgtar_create (char **inpattern, const char *files_from, int null_names,
snprintf (tmpbuf, sizeof tmpbuf, "--status-fd=%d", opt.status_fd);
ccparray_put (&ccp, tmpbuf);
except[0] = opt.status_fd;
}
ccparray_put (&ccp, "--output");
@ -1205,7 +1207,9 @@ gpgtar_create (char **inpattern, const char *files_from, int null_names,
goto leave;
}
err = gnupg_spawn_process (opt.gpg_program, argv, NULL, NULL,
err = gnupg_spawn_process (opt.gpg_program, argv,
except[0] == -1? NULL : except,
NULL,
(GNUPG_SPAWN_KEEP_STDOUT
| GNUPG_SPAWN_KEEP_STDERR),
&outstream, NULL, NULL, &pid);