summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
142cb9e)
Some kernel versions don't put a space between 'active' and '(auto-read-only)'
in /proc/mdstat. This causes a parsing problem leaving 'level' set to
NULL which causes a crash.
So synthesise a space there if it is missing, and check for 'level' to
be NULL and don't de-ref if it is.
+Changes Prior to this release
+ - Avoid segfault when parsing /proc/mdstat with auto-read-only
+ arrays.
+
Changes Prior to 2.6.4 release
- Make "--create --auto=mdp" work for non-standard device names.
- Fix restarting of a 'reshape' if it was stopped in the middle.
Changes Prior to 2.6.4 release
- Make "--create --auto=mdp" work for non-standard device names.
- Fix restarting of a 'reshape' if it was stopped in the middle.
struct supertype *st2;
sra = sysfs_read(mdfd, devnum, (GET_VERSION | GET_DEVS |
GET_STATE));
struct supertype *st2;
sra = sysfs_read(mdfd, devnum, (GET_VERSION | GET_DEVS |
GET_STATE));
if (sra->array.major_version != st->ss->major ||
sra->array.minor_version != st->minor_version) {
if (verbose >= 0)
if (sra->array.major_version != st->ss->major ||
sra->array.minor_version != st->minor_version) {
if (verbose >= 0)
struct mdstat_ent *mse;
for (mse=mdstat; mse; mse=mse->next)
if (mse->devnum != INT_MAX &&
struct mdstat_ent *mse;
for (mse=mdstat; mse; mse=mse->next)
if (mse->devnum != INT_MAX &&
(strcmp(mse->level, "raid0")!=0 &&
strcmp(mse->level, "linear")!=0)
) {
(strcmp(mse->level, "raid0")!=0 &&
strcmp(mse->level, "linear")!=0)
) {
word[len++] = c;
}
c = getc(file);
word[len++] = c;
}
c = getc(file);
+ /* Hack for broken kernels (2.6.14-.24) that put
+ * "active(auto-read-only)"
+ * in /proc/mdstat instead of
+ * "active (auto-read-only)"
+ */
+ if (c == '(' && len >= 6
+ && strncmp(word+len-6, "active", 6) == 0)
+ c = ' ';
}
}
if (c != EOF) ungetc(c, file);
}
word[len] = 0;
}
}
if (c != EOF) ungetc(c, file);
}
word[len] = 0;
+
+ /* Further HACK for broken kernels.. 2.6.14-2.6.24 */
+ if (strcmp(word, "auto-read-only)") == 0)
+ strcpy(word, "(auto-read-only)");
+
/* printf("word is <%s>\n", word); */
if (!wordfound) {
free(word);
/* printf("word is <%s>\n", word); */
if (!wordfound) {
free(word);