diff options
author | Neil Brown <neilb@suse.de> | 2004-01-22 02:10:29 +0000 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2004-01-22 02:10:29 +0000 |
commit | 98c6faba80e6db0693f99faf5c6525ef4f1fb680 (patch) | |
tree | 73c58aeb3bd022665431cc513ce2bfd6f1560cd4 /mdstat.c | |
parent | feb716e9c3568a45b8815bf2c59e417d30635f89 (diff) |
mdadm-1.5.0
Diffstat (limited to 'mdstat.c')
-rw-r--r-- | mdstat.c | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -114,6 +114,8 @@ struct mdstat_ent *mdstat_read() for (; (line = conf_line(f)) ; free_line(line)) { struct mdstat_ent *ent; char *w; + int devnum; + char *ep; if (strcmp(line, "Personalities")==0) continue; @@ -122,9 +124,16 @@ struct mdstat_ent *mdstat_read() if (strcmp(line, "unused")==0) continue; /* Better be an md line.. */ - if (strncmp(line, "md", 2)!= 0 - || atoi(line+2)<0) { - fprintf(stderr, Name ": bad /proc/mdstat line starts: %s\n", line); + if (strncmp(line, "md", 2)!= 0) + continue; + if (strncmp(line, "md_d", 4) == 0) + devnum = -1-strtoul(line+4, &ep, 10); + else if (strncmp(line, "md", 2) == 0) + devnum = strtoul(line+2, &ep, 10); + else + continue; + if (ep == NULL || *ep ) { + /* fprintf(stderr, Name ": bad /proc/mdstat line starts: %s\n", line); */ continue; } @@ -141,7 +150,7 @@ struct mdstat_ent *mdstat_read() ent->active = -1; ent->dev = strdup(line); - ent->devnum = atoi(line+2); + ent->devnum = devnum; for (w=dl_next(line); w!= line ; w=dl_next(w)) { int l = strlen(w); |