lib/sysfs: Use dup_fd_cloexec instead of direct call to fcntl

Signed-off-by: Guillem Jover <guillem@hadrons.org>
This commit is contained in:
Guillem Jover 2015-06-06 06:19:06 +02:00 committed by Karel Zak
parent 8e86d93d1e
commit fef6f84a15
1 changed files with 1 additions and 1 deletions

View File

@ -267,7 +267,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 = fcntl(cxt->dir_fd, F_DUPFD_CLOEXEC, STDERR_FILENO + 1);
fd = dup_fd_cloexec(cxt->dir_fd, STDERR_FILENO + 1);
if (fd < 0)
return NULL;