From f2232e8bc2b7e5b117a5e5b17ead672df95b481e Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Thu, 13 Dec 2001 22:36:03 +0000 Subject: [PATCH] 2001-12-13 Marcus Brinkmann * 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. --- gpgme/ChangeLog | 8 ++++++++ gpgme/rungpg.c | 13 ++----------- gpgme/version.c | 6 ++---- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index 0aca485..569005f 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,3 +1,11 @@ +2001-12-13 Marcus Brinkmann + + * 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 * engine-gpgsm.c (_gpgme_gpgsm_op_encrypt): Do not add `armor' diff --git a/gpgme/rungpg.c b/gpgme/rungpg.c index d1c50cc..6151f7d 100644 --- a/gpgme/rungpg.c +++ b/gpgme/rungpg.c @@ -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; diff --git a/gpgme/version.c b/gpgme/version.c index 762b6ea..b2146db 100644 --- a/gpgme/version.c +++ b/gpgme/version.c @@ -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) -- 2.26.2