Fix const qualifier discarded warning in mnt_parse_mountinfo_line().
This warning is reported by gcc 15 which defaults to the C23 standard.
The strstr() function returns a pointer into a const string, so
introduce a separate 'sep' variable to hold this const pointer,
keeping 'p' for non-const unmangle() results that need to be freed.
Signed-off-by: Karel Zak <kzak@redhat.com>
int rc = 0;
unsigned int maj, min;
char *p;
+ const char *sep;
fs->flags |= MNT_FS_KERNEL;
mnt_fs_mark_attached(fs);
}
/* (7) optional fields, terminated by " - " */
- p = strstr(s, " - ");
- if (!p) {
+ sep = strstr(s, " - ");
+ if (!sep) {
DBG(TAB, ul_debug("mountinfo parse error: separator not found"));
return -EINVAL;
}
- if (p > s + 1)
- fs->opt_fields = strndup(s + 1, p - s - 1);
+ if (sep > s + 1)
+ fs->opt_fields = strndup(s + 1, sep - s - 1);
- s = skip_separator(p + 3);
+ s = skip_separator(sep + 3);
/* (8) FS type */
p = unmangle(s, &s);