2001-12-13 Marcus Brinkmann <marcus@g10code.de>

* rungpg.c (_gpgme_gpg_spawn): Do not add the fds to the child
	list that are not dup'ed, for those the close-on-exec flag is set
	now.
	* version.c (_gpgme_get_program_version): Remove first entry in
	CFD, as the close-on-exec flag is now set for this fd.
This commit is contained in:
Marcus Brinkmann 2001-12-13 22:36:03 +00:00
parent 77a72c0d5e
commit f2232e8bc2
3 changed files with 12 additions and 15 deletions

View File

@ -1,3 +1,11 @@
2001-12-13 Marcus Brinkmann <marcus@g10code.de>
* rungpg.c (_gpgme_gpg_spawn): Do not add the fds to the child
list that are not dup'ed, for those the close-on-exec flag is set
now.
* version.c (_gpgme_get_program_version): Remove first entry in
CFD, as the close-on-exec flag is now set for this fd.
2001-12-13 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (_gpgme_gpgsm_op_encrypt): Do not add `armor'

View File

@ -818,9 +818,9 @@ _gpgme_gpg_spawn( GpgObject gpg, void *opaque )
if ( rc )
return rc;
n = 4; /* status fd, 2*colon_fd and end of list */
n = 3; /* status_fd, colon_fd and end of list */
for (i=0; gpg->fd_data_map[i].data; i++ )
n += 2;
n++;
fd_child_list = xtrycalloc ( n+n, sizeof *fd_child_list );
if (!fd_child_list)
return mk_error (Out_Of_Core);
@ -828,21 +828,12 @@ _gpgme_gpg_spawn( GpgObject gpg, void *opaque )
/* build the fd list for the child */
n=0;
fd_child_list[n].fd = gpg->status.fd[0];
fd_child_list[n].dup_to = -1;
n++;
if ( gpg->colon.fnc ) {
fd_child_list[n].fd = gpg->colon.fd[0];
fd_child_list[n].dup_to = -1;
n++;
fd_child_list[n].fd = gpg->colon.fd[1];
fd_child_list[n].dup_to = 1; /* dup to stdout */
n++;
}
for (i=0; gpg->fd_data_map[i].data; i++ ) {
fd_child_list[n].fd = gpg->fd_data_map[i].fd;
fd_child_list[n].dup_to = -1;
n++;
if (gpg->fd_data_map[i].dup_to != -1) {
fd_child_list[n].fd = gpg->fd_data_map[i].peer_fd;
fd_child_list[n].dup_to = gpg->fd_data_map[i].dup_to;

View File

@ -203,8 +203,7 @@ _gpgme_get_program_version (const char *const path)
int nread;
char *argv[] = {(char *) path, "--version", 0};
struct spawn_fd_item_s pfd[] = { {0, -1}, {-1, -1} };
struct spawn_fd_item_s cfd[] = { {0, -1}, {-1, 1 /* STDOUT_FILENO */},
{-1, -1} };
struct spawn_fd_item_s cfd[] = { {-1, 1 /* STDOUT_FILENO */}, {-1, -1} };
int status, signal;
if (!path)
@ -214,8 +213,7 @@ _gpgme_get_program_version (const char *const path)
return NULL;
pfd[0].fd = rp[1];
cfd[0].fd = rp[0];
cfd[1].fd = rp[1];
cfd[0].fd = rp[1];
pid = _gpgme_io_spawn (path, argv, cfd, pfd);
if (pid < 0)