mdadm/mdadm-2.6.2-file-leak.patch
Doug Ledford fd828476e8 - Fix a file leak issue when mdadm is in monitor mode
- Update mdadm init script so that status will always run and so return
    codes are standards compliant
- Fix assembly of version 1 superblock devices
- Make the attempt to create an already running device have a clearer error
    message
- Allow the creation of a degraded raid4 array like we allow for raid5
- Make mdadm actually pay attention to raid4 devices when in monitor mode
- Make the mdmonitor script use daemon() correctly
- Fix a bug where manage mode would not add disks correctly under certain
    conditions
- Resolves: bz244582, bz242688, bz230207, bz169596, bz171862, bz171938
- Resolves: bz174642, bz224272, bz186524
2007-07-03 20:04:11 +00:00

24 lines
626 B
Diff

--- mdadm-2.6.2/mdstat.c.fileleak 2007-07-02 12:25:01.000000000 -0400
+++ mdadm-2.6.2/mdstat.c 2007-07-02 12:25:04.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,