diff options
author | Karel Zak | 2012-06-14 11:38:53 +0200 |
---|---|---|
committer | Karel Zak | 2012-06-14 11:38:53 +0200 |
commit | 6b741564d84ee21573b3ebff5510f6b050028d06 (patch) | |
tree | 100c9317559bc6380daa231db834e8593401bcd6 /libmount/src/context_mount.c | |
parent | eject: cleanup umount code (diff) | |
download | kernel-qcow2-util-linux-6b741564d84ee21573b3ebff5510f6b050028d06.tar.gz kernel-qcow2-util-linux-6b741564d84ee21573b3ebff5510f6b050028d06.tar.xz kernel-qcow2-util-linux-6b741564d84ee21573b3ebff5510f6b050028d06.zip |
libmount: don't generate empty option strings
mount -t foo something /mnt/test -o user=root,password=linux
generates
"rw,noexec,nosuid,nodev,password=linux,,user=root"
options string for /sbin/mount.foo, the ",," is incorrect.
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/context_mount.c')
-rw-r--r-- | libmount/src/context_mount.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c index 264276899..6661394ff 100644 --- a/libmount/src/context_mount.c +++ b/libmount/src/context_mount.c @@ -67,16 +67,27 @@ static int fix_optstr(struct libmnt_context *cxt) /* * Sync mount options with mount flags */ + DBG(CXT, mnt_debug_h(cxt, "mount: fixing vfs optstr")); rc = mnt_optstr_apply_flags(&fs->vfs_optstr, cxt->mountflags, mnt_get_builtin_optmap(MNT_LINUX_MAP)); if (rc) goto done; + DBG(CXT, mnt_debug_h(cxt, "mount: fixing user optstr")); rc = mnt_optstr_apply_flags(&fs->user_optstr, cxt->user_mountflags, mnt_get_builtin_optmap(MNT_USERSPACE_MAP)); if (rc) goto done; + if (fs->vfs_optstr && *fs->vfs_optstr == '\0') { + free(fs->vfs_optstr); + fs->vfs_optstr = NULL; + } + if (fs->user_optstr && *fs->user_optstr == '\0') { + free(fs->user_optstr); + fs->user_optstr = NULL; + } + next = fs->fs_optstr; #ifdef HAVE_LIBSELINUX |