}
/* fstab is not required if source and target are specified */
- if (src && tgt && !(cxt->optsmode == MNT_OMODE_FORCE))
+ if (src && tgt && !(cxt->optsmode & MNT_OMODE_FORCE)) {
+ DBG(CXT, mnt_debug_h(cxt, "fstab not required -- skip"));
return 0;
+ }
DBG(CXT, mnt_debug_h(cxt,
"trying to apply fstab (src=%s, target=%s)", src, tgt));
}
if (!rc && cxt->user_mountflags && MNT_MS_USER)
- rc = mnt_optstr_fix_user(&fs->fs_optstr);
+ rc = mnt_optstr_fix_user(&fs->user_optstr);
done:
DBG(CXT, mnt_debug_h(cxt, "fixed options [rc=%d]: "
- "vfs='%s' fs='%s' user='%s'", rc,
+ "vfs: '%s' fs: '%s' user: '%s'", rc,
fs->vfs_optstr, fs->fs_optstr, fs->user_optstr));
return rc;
}
if (!username)
return -ENOMEM;
- if (!ol.valsz || strncmp(ol.value, username, ol.valsz)) {
+ if (!ol.valsz || (ol.value && strncmp(ol.value, username, ol.valsz))) {
if (ol.valsz)
/* remove old value */
mnt_optstr_remove_option_at(optstr, ol.value, ol.end);
- rc = insert_value(optstr, ol.value, username, NULL);
+ rc = insert_value(optstr, ol.value ? ol.value : ol.end,
+ username, NULL);
}
free(username);