summaryrefslogtreecommitdiffstats
path: root/lib/sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sysfs.c')
-rw-r--r--lib/sysfs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sysfs.c b/lib/sysfs.c
index ac3559619..1b2019112 100644
--- a/lib/sysfs.c
+++ b/lib/sysfs.c
@@ -246,7 +246,7 @@ DIR *sysfs_opendir(struct sysfs_cxt *cxt, const char *attr)
* -- we cannot use cxt->sysfs_fd directly, because closedir()
* will close this our persistent file descriptor.
*/
- fd = dup(cxt->dir_fd);
+ fd = fcntl(cxt->dir_fd, F_DUPFD_CLOEXEC, STDERR_FILENO + 1);
if (fd < 0)
return NULL;