From f000c76be449460e27360c549bbb08749b620962 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 27 Nov 2017 13:39:18 +0100 Subject: [PATCH] core: replace "dup()" by "fcntl(fd, F_DUPFD_CLOEXEC, 0)" (cherry picked from commit 1e572ebf87b44513f5c4ede266f7c2b8113b3cb6) --- src/nm-core-utils.c | 2 +- src/settings/plugins/ifcfg-rh/shvar.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nm-core-utils.c b/src/nm-core-utils.c index 00a44fde58..40a0c352af 100644 --- a/src/nm-core-utils.c +++ b/src/nm-core-utils.c @@ -2835,7 +2835,7 @@ nm_utils_fd_get_contents (int fd, if (fd_keeper >= 0) fd2 = nm_steal_fd (&fd_keeper); else { - fd2 = dup (fd); + fd2 = fcntl (fd, F_DUPFD_CLOEXEC, 0); if (fd2 < 0) return _get_contents_error (error, 0, "error during dup"); } diff --git a/src/settings/plugins/ifcfg-rh/shvar.c b/src/settings/plugins/ifcfg-rh/shvar.c index 1b4529c4e1..3c09b66dd6 100644 --- a/src/settings/plugins/ifcfg-rh/shvar.c +++ b/src/settings/plugins/ifcfg-rh/shvar.c @@ -1318,7 +1318,7 @@ svWriteFile (shvarFile *s, int mode, GError **error) return FALSE; } - tmpfd = dup (s->fd); + tmpfd = fcntl (s->fd, F_DUPFD_CLOEXEC, 0); if (tmpfd == -1) { int errsv = errno;