aboutsummaryrefslogtreecommitdiffstats
path: root/common/exechelp-posix.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2016-05-27 20:22:37 +0000
committerWerner Koch <[email protected]>2016-05-27 20:22:37 +0000
commite6d9a2d07ed7aeac3944d8a7d1317c4a117356b4 (patch)
treeb48aad8f55d1a8074e54504be2d686209a73424a /common/exechelp-posix.c
parentcommon: Speedup closing fds before an exec. (diff)
downloadgnupg-e6d9a2d07ed7aeac3944d8a7d1317c4a117356b4.tar.gz
gnupg-e6d9a2d07ed7aeac3944d8a7d1317c4a117356b4.zip
common: Simplify the fd closing patch 512c56a.
* common/exechelp-posix.c (get_max_fds): Use /proc/self. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'common/exechelp-posix.c')
-rw-r--r--common/exechelp-posix.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/common/exechelp-posix.c b/common/exechelp-posix.c
index 81831eeb1..a7a9a929d 100644
--- a/common/exechelp-posix.c
+++ b/common/exechelp-posix.c
@@ -114,14 +114,12 @@ get_max_fds (void)
* that list before starting to close them. */
#ifdef __linux__
{
- char dirname[50];
DIR *dir = NULL;
struct dirent *dir_entry;
const char *s;
int x;
- snprintf (dirname, sizeof dirname, "/proc/%u/fd", (unsigned int)getpid ());
- dir = opendir (dirname);
+ dir = opendir ("/proc/self/fd");
if (dir)
{
while ((dir_entry = readdir (dir)))