aboutsummaryrefslogtreecommitdiffstats
path: root/common/exechelp.h
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2009-03-19 07:09:31 +0000
committerWerner Koch <[email protected]>2009-03-19 07:09:31 +0000
commit588a7c34bb6cdffa8ec40d1e7fda047c5da38a61 (patch)
tree1399895643266c827878425babeb84039d6f4295 /common/exechelp.h
parentAdd server option with-ephemeral-keys. (diff)
downloadgnupg-588a7c34bb6cdffa8ec40d1e7fda047c5da38a61.tar.gz
gnupg-588a7c34bb6cdffa8ec40d1e7fda047c5da38a61.zip
Make sure not to leak file descriptors if running gpg-agent with a
command. Restore the signal mask to solve a problem in Mono.
Diffstat (limited to '')
-rw-r--r--common/exechelp.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/common/exechelp.h b/common/exechelp.h
index 0ad956f7a..0efee294c 100644
--- a/common/exechelp.h
+++ b/common/exechelp.h
@@ -1,5 +1,5 @@
/* exechelp.h - Definitions for the fork and exec helpers
- * Copyright (C) 2004 Free Software Foundation, Inc.
+ * Copyright (C) 2004, 2009 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -20,6 +20,25 @@
#ifndef GNUPG_COMMON_EXECHELP_H
#define GNUPG_COMMON_EXECHELP_H
+/* Return the maximum number of currently allowed file descriptors.
+ Only useful on POSIX systems. */
+int get_max_fds (void);
+
+
+/* Close all file descriptors starting with descriptor FIRST. If
+ EXCEPT is not NULL, it is expected to be a list of file descriptors
+ which are not to close. This list shall be sorted in ascending
+ order with its end marked by -1. */
+void close_all_fds (int first, int *except);
+
+
+/* Returns an array with all currently open file descriptors. The end
+ of the array is marked by -1. The caller needs to release this
+ array using the *standard free* and not with xfree. This allow the
+ use of this fucntion right at startup even before libgcrypt has
+ been initialized. Returns NULL on error and sets ERRNO accordingly. */
+int *get_all_open_fds (void);
+
/* Portable function to create a pipe. Under Windows the write end is
inheritable. */