mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01: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:
parent
338a5ecaa1
commit
f79d9b9310
@ -1141,6 +1141,7 @@ gpgtar_create (char **inpattern, const char *files_from, int null_names,
|
|||||||
{
|
{
|
||||||
strlist_t arg;
|
strlist_t arg;
|
||||||
ccparray_t ccp;
|
ccparray_t ccp;
|
||||||
|
int except[2] = { -1, -1 };
|
||||||
const char **argv;
|
const char **argv;
|
||||||
|
|
||||||
/* '--encrypt' may be combined with '--symmetric', but 'encrypt'
|
/* '--encrypt' may be combined with '--symmetric', but 'encrypt'
|
||||||
@ -1164,6 +1165,7 @@ gpgtar_create (char **inpattern, const char *files_from, int null_names,
|
|||||||
|
|
||||||
snprintf (tmpbuf, sizeof tmpbuf, "--status-fd=%d", opt.status_fd);
|
snprintf (tmpbuf, sizeof tmpbuf, "--status-fd=%d", opt.status_fd);
|
||||||
ccparray_put (&ccp, tmpbuf);
|
ccparray_put (&ccp, tmpbuf);
|
||||||
|
except[0] = opt.status_fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
ccparray_put (&ccp, "--output");
|
ccparray_put (&ccp, "--output");
|
||||||
@ -1195,7 +1197,8 @@ gpgtar_create (char **inpattern, const char *files_from, int null_names,
|
|||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = gnupg_spawn_process (opt.gpg_program, argv, NULL,
|
err = gnupg_spawn_process (opt.gpg_program, argv,
|
||||||
|
except[0] == -1? NULL : except,
|
||||||
(GNUPG_SPAWN_KEEP_STDOUT
|
(GNUPG_SPAWN_KEEP_STDOUT
|
||||||
| GNUPG_SPAWN_KEEP_STDERR),
|
| GNUPG_SPAWN_KEEP_STDERR),
|
||||||
&outstream, NULL, NULL, &pid);
|
&outstream, NULL, NULL, &pid);
|
||||||
|
@ -369,6 +369,7 @@ gpgtar_extract (const char *filename, int decrypt)
|
|||||||
{
|
{
|
||||||
strlist_t arg;
|
strlist_t arg;
|
||||||
ccparray_t ccp;
|
ccparray_t ccp;
|
||||||
|
int except[2] = { -1, -1 };
|
||||||
const char **argv;
|
const char **argv;
|
||||||
|
|
||||||
ccparray_init (&ccp, 0);
|
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);
|
snprintf (tmpbuf, sizeof tmpbuf, "--status-fd=%d", opt.status_fd);
|
||||||
ccparray_put (&ccp, tmpbuf);
|
ccparray_put (&ccp, tmpbuf);
|
||||||
|
except[0] = opt.status_fd;
|
||||||
}
|
}
|
||||||
if (opt.with_log)
|
if (opt.with_log)
|
||||||
{
|
{
|
||||||
@ -408,7 +410,8 @@ gpgtar_extract (const char *filename, int decrypt)
|
|||||||
goto leave;
|
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)
|
((filename? 0 : GNUPG_SPAWN_KEEP_STDIN)
|
||||||
| GNUPG_SPAWN_KEEP_STDERR),
|
| GNUPG_SPAWN_KEEP_STDERR),
|
||||||
NULL, &stream, NULL, &pid);
|
NULL, &stream, NULL, &pid);
|
||||||
|
@ -468,6 +468,7 @@ gpgtar_list (const char *filename, int decrypt)
|
|||||||
{
|
{
|
||||||
strlist_t arg;
|
strlist_t arg;
|
||||||
ccparray_t ccp;
|
ccparray_t ccp;
|
||||||
|
int except[2] = { -1, -1 };
|
||||||
const char **argv;
|
const char **argv;
|
||||||
|
|
||||||
ccparray_init (&ccp, 0);
|
ccparray_init (&ccp, 0);
|
||||||
@ -481,6 +482,7 @@ gpgtar_list (const char *filename, int decrypt)
|
|||||||
|
|
||||||
snprintf (tmpbuf, sizeof tmpbuf, "--status-fd=%d", opt.status_fd);
|
snprintf (tmpbuf, sizeof tmpbuf, "--status-fd=%d", opt.status_fd);
|
||||||
ccparray_put (&ccp, tmpbuf);
|
ccparray_put (&ccp, tmpbuf);
|
||||||
|
except[0] = opt.status_fd;
|
||||||
}
|
}
|
||||||
ccparray_put (&ccp, "--output");
|
ccparray_put (&ccp, "--output");
|
||||||
ccparray_put (&ccp, "-");
|
ccparray_put (&ccp, "-");
|
||||||
@ -501,7 +503,8 @@ gpgtar_list (const char *filename, int decrypt)
|
|||||||
goto leave;
|
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)
|
((filename? 0 : GNUPG_SPAWN_KEEP_STDIN)
|
||||||
| GNUPG_SPAWN_KEEP_STDERR),
|
| GNUPG_SPAWN_KEEP_STDERR),
|
||||||
NULL, &stream, NULL, &pid);
|
NULL, &stream, NULL, &pid);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user