mirror of
git://git.gnupg.org/gnupg.git
synced 2025-02-01 16:33:02 +01:00
common: Simplify the fd closing patch 512c56a.
* common/exechelp-posix.c (get_max_fds): Use /proc/self. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
512c56af43
commit
e6d9a2d07e
@ -114,14 +114,12 @@ get_max_fds (void)
|
|||||||
* that list before starting to close them. */
|
* that list before starting to close them. */
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
{
|
{
|
||||||
char dirname[50];
|
|
||||||
DIR *dir = NULL;
|
DIR *dir = NULL;
|
||||||
struct dirent *dir_entry;
|
struct dirent *dir_entry;
|
||||||
const char *s;
|
const char *s;
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
snprintf (dirname, sizeof dirname, "/proc/%u/fd", (unsigned int)getpid ());
|
dir = opendir ("/proc/self/fd");
|
||||||
dir = opendir (dirname);
|
|
||||||
if (dir)
|
if (dir)
|
||||||
{
|
{
|
||||||
while ((dir_entry = readdir (dir)))
|
while ((dir_entry = readdir (dir)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user