]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdstat.c
Add crc32 files.
[thirdparty/mdadm.git] / mdstat.c
index de31acbf305ea96c6101857ff1b228ee23eb1719..a8f7ce7576eb1d017acfe962a1dea48084cde5d2 100644 (file)
--- a/mdstat.c
+++ b/mdstat.c
@@ -114,6 +114,8 @@ struct mdstat_ent *mdstat_read(int hold, int start)
                f = fopen("/proc/mdstat", "r");
        if (f == NULL)
                return NULL;
+       else
+               fcntl(fileno(f), F_SETFD, FD_CLOEXEC);
 
        all = NULL;
        end = &all;
@@ -159,7 +161,7 @@ struct mdstat_ent *mdstat_read(int hold, int start)
 
                ent->dev = strdup(line);
                ent->devnum = devnum;
-               
+
                for (w=dl_next(line); w!= line ; w=dl_next(w)) {
                        int l = strlen(w);
                        char *eq;
@@ -207,7 +209,7 @@ struct mdstat_ent *mdstat_read(int hold, int start)
                                   strncmp(w, "resync", 4)==0) {
                                ent->resync = 1;
                        } else if (ent->percent == -1 &&
-                                  w[0] >= '0' && 
+                                  w[0] >= '0' &&
                                   w[0] <= '9' &&
                                   w[l-1] == '%') {
                                ent->percent = atoi(w);
@@ -221,8 +223,10 @@ struct mdstat_ent *mdstat_read(int hold, int start)
                        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,