Make sure /proc/$$/fd exists.

This avoids the error message generated by enumerator_create_directory().
This commit is contained in:
Tobias Brunner
2011-10-13 11:22:40 +02:00
parent 5051bd23eb
commit 4a4cf41b9a
+1 -1
View File
@@ -205,7 +205,7 @@ void closefrom(int lowfd)
/* try to close only open file descriptors on Linux... */
len = snprintf(fd_dir, sizeof(fd_dir), "/proc/%u/fd", getpid());
if (len > 0 && len < sizeof(fd_dir))
if (len > 0 && len < sizeof(fd_dir) && access(fd_dir, F_OK) == 0)
{
enumerator_t *enumerator = enumerator_create_directory(fd_dir);
if (enumerator)