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;