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

Make sure not to leak file descriptors if running gpg-agent with a

command.  Restore the signal mask to solve a problem in Mono.
This commit is contained in:
Werner Koch 2009-03-19 07:09:31 +00:00
parent a3b63ac1dc
commit 588a7c34bb
11 changed files with 252 additions and 28 deletions

View file

@ -57,6 +57,7 @@
#include "cardglue.h"
#else /* GNUPG_MAJOR_VERSION != 1 */
#include "scdaemon.h"
#include "exechelp.h"
#endif /* GNUPG_MAJOR_VERSION != 1 */
#include "apdu.h"
@ -81,11 +82,6 @@
#define DLSTDCALL
#endif
#ifdef _POSIX_OPEN_MAX
#define MAX_OPEN_FDS _POSIX_OPEN_MAX
#else
#define MAX_OPEN_FDS 20
#endif
/* Helper to pass parameters related to keypad based operations. */
struct pininfo_s
@ -1653,12 +1649,7 @@ open_pcsc_reader_wrapped (const char *portstr)
log_fatal ("dup2 stderr failed: %s\n", strerror (errno));
/* Close all other files. */
n = sysconf (_SC_OPEN_MAX);
if (n < 0)
n = MAX_OPEN_FDS;
for (i=3; i < n; i++)
close(i);
errno = 0;
close_all_fds (3, NULL);
execl (wrapperpgm,
"pcsc-wrapper",