#define mnt_init_optloc(_ol) (memset((_ol), 0, sizeof(struct libmnt_optloc)))
+#define mnt_optmap_entry_novalue(e) \
+ (e && (e)->name && !strchr((e)->name, '=') && !((e)->mask & MNT_PREFIX))
+
/*
* Parses the first option from @optstr. The @optstr pointer is set to begin of
* the next option.
if (ent && !ent->id)
continue; /* ignore undefined options (comments) */
+ /* ignore name=<value> if options map expects <name> only */
+ if (valsz && mnt_optmap_entry_novalue(ent))
+ m = NULL;
+
if (ent && m && m == maps[0] && vfs) {
if (ignore_vfs && (ent->mask & ignore_vfs))
continue;
if (ignore && (ent->mask & ignore))
continue;
+
+ /* ignore name=<value> if options map expects <name> only */
+ if (valsz && mnt_optmap_entry_novalue(ent))
+ continue;
+
rc = __mnt_optstr_append_option(subset, name, namesz, val, valsz);
if (rc) {
free(*subset);
if (!m || !ent || !ent->id)
continue;
+ /* ignore name=<value> if options map expects <name> only */
+ if (valsz && mnt_optmap_entry_novalue(ent))
+ continue;
+
if (m == map) { /* requested map */
if (ent->mask & MNT_INVERT)
*flags &= ~ent->id;
/*
* remove unwanted option (rw/ro is already set)
*/
- if (!ent->id)
+ if (!ent || !ent->id)
continue;
+ /* ignore name=<value> if options map expects <name> only */
+ if (valsz && mnt_optmap_entry_novalue(ent))
+ continue;
+
if (ent->id == MS_RDONLY ||
(ent->mask & MNT_INVERT) ||
(fl & ent->id) != (unsigned long) ent->id) {