Version 2.02.96 -
================================
+ Support improperly formated device numbers in /proc/devices (2.02.91).
Fix fsadm propagation of -e option.
Fix fsadm parsing of /proc/mounts files (don't check for substrings).
Fix fsadm usage of arguments with space.
size_t dev_len = 0;
const struct dm_config_value *cv;
const char *name;
-
+ char *nl;
if (!*proc) {
log_verbose("No proc filesystem found: using all block device "
/* If it's not a number it may be name of section */
line_maj = atoi(((char *) (line + i)));
- if ((line_maj <= 0) || (line_maj >= NUMBER_OF_MAJORS)) {
+
+ if (line_maj < 0 || line_maj >= NUMBER_OF_MAJORS) {
+ /*
+ * Device numbers shown in /proc/devices are actually direct
+ * numbers passed to registering function, however the kernel
+ * uses only 12 bits, so use just 12 bits for major.
+ */
+ if ((nl = strchr(line, '\n'))) *nl = '\0';
+ log_warn("WARNING: /proc/devices line: %s, replacing major with %d.",
+ line, line_maj & (NUMBER_OF_MAJORS - 1));
+ line_maj &= (NUMBER_OF_MAJORS - 1);
+ }
+
+ if (!line_maj) {
blocksection = (line[i] == 'B') ? 1 : 0;
continue;
}