all: use O_CLOEXEC for file descriptors

This commit is contained in:
Thomas Haller
2016-12-10 15:28:15 +01:00
parent e332c27824
commit 4bdee37771
18 changed files with 35 additions and 34 deletions

View File

@@ -95,7 +95,7 @@ nm_main_utils_write_pidfile (const char *pidfile)
int fd;
gboolean success = FALSE;
if ((fd = open (pidfile, O_CREAT|O_WRONLY|O_TRUNC, 00644)) < 0) {
if ((fd = open (pidfile, O_CREAT | O_WRONLY | O_TRUNC | O_CLOEXEC, 00644)) < 0) {
fprintf (stderr, _("Opening %s failed: %s\n"), pidfile, strerror (errno));
return FALSE;
}