common: Simplify the fd closing patch 512c56a.
authorWerner Koch <wk@gnupg.org>
Fri, 27 May 2016 20:22:37 +0000 (22:22 +0200)
committerWerner Koch <wk@gnupg.org>
Fri, 27 May 2016 20:22:37 +0000 (22:22 +0200)
* common/exechelp-posix.c (get_max_fds): Use /proc/self.

Signed-off-by: Werner Koch <wk@gnupg.org>
common/exechelp-posix.c

index 81831ee..a7a9a92 100644 (file)
@@ -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)))