--- mdadm-2.6.2/Monitor.c.leak 2007-07-06 12:20:05.000000000 -0400 +++ mdadm-2.6.2/Monitor.c 2007-07-06 12:21:44.000000000 -0400 @@ -234,6 +234,7 @@ int Monitor(mddev_dev_t devlist, */ st->err=1; continue; } + fcntl(fd, F_SETFD, FD_CLOEXEC); if (ioctl(fd, GET_ARRAY_INFO, &array)<0) { if (!st->err) alert("DeviceDisappeared", dev, NULL, --- mdadm-2.6.2/mdstat.c.leak 2006-12-18 21:35:17.000000000 -0500 +++ mdadm-2.6.2/mdstat.c 2007-07-06 12:19:55.000000000 -0400 @@ -114,6 +114,8 @@ struct mdstat_ent *mdstat_read(int hold, f = fopen("/proc/mdstat", "r"); if (f == NULL) return NULL; + else + fcntl(fileno(f), F_SETFD, FD_CLOEXEC); all = NULL; end = &all; @@ -221,8 +223,10 @@ struct mdstat_ent *mdstat_read(int hold, end = &ent->next; } } - if (hold && mdstat_fd == -1) + if (hold && mdstat_fd == -1) { mdstat_fd = dup(fileno(f)); + fcntl(mdstat_fd, F_SETFD, FD_CLOEXEC); + } fclose(f); /* If we might want to start array,