summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak2011-01-25 01:11:37 +0100
committerKarel Zak2011-01-25 01:11:37 +0100
commit5a669b12f84f85f7ace13712b20ce9592a08f157 (patch)
treee0d1db464c5b7c72f9b0c637b883c2fcadecf442
parentlibmount: improve status check, minor cleanups (diff)
downloadkernel-qcow2-util-linux-5a669b12f84f85f7ace13712b20ce9592a08f157.tar.gz
kernel-qcow2-util-linux-5a669b12f84f85f7ace13712b20ce9592a08f157.tar.xz
kernel-qcow2-util-linux-5a669b12f84f85f7ace13712b20ce9592a08f157.zip
libmount: fix user= usage
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--shlibs/mount/src/context.c4
-rw-r--r--shlibs/mount/src/context_mount.c4
-rw-r--r--shlibs/mount/src/optstr.c5
3 files changed, 8 insertions, 5 deletions
diff --git a/shlibs/mount/src/context.c b/shlibs/mount/src/context.c
index ed9f223ae..676552bf1 100644
--- a/shlibs/mount/src/context.c
+++ b/shlibs/mount/src/context.c
@@ -1440,8 +1440,10 @@ int mnt_context_apply_fstab(struct libmnt_context *cxt)
}
/* 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));
diff --git a/shlibs/mount/src/context_mount.c b/shlibs/mount/src/context_mount.c
index 0b6c3d864..8c764078d 100644
--- a/shlibs/mount/src/context_mount.c
+++ b/shlibs/mount/src/context_mount.c
@@ -107,11 +107,11 @@ static int fix_optstr(struct libmnt_context *cxt)
}
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;
}
diff --git a/shlibs/mount/src/optstr.c b/shlibs/mount/src/optstr.c
index 9c8aa62e6..fd4a8610c 100644
--- a/shlibs/mount/src/optstr.c
+++ b/shlibs/mount/src/optstr.c
@@ -945,12 +945,13 @@ int mnt_optstr_fix_user(char **optstr)
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);