From 87a07a4cc8592a937006c5cdb93739b185bdbd7c Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 15 Dec 2010 15:06:42 +0100 Subject: [PATCH] libmount: minor fixes Signed-off-by: Karel Zak --- shlibs/mount/src/Makefile.am | 2 +- shlibs/mount/src/context.c | 3 +++ shlibs/mount/src/context_mount.c | 3 --- shlibs/mount/src/fs.c | 2 +- shlibs/mount/src/tab_update.c | 5 +++++ tests/ts/libmount/context | 1 - 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/shlibs/mount/src/Makefile.am b/shlibs/mount/src/Makefile.am index 261effa1..6c241ba2 100644 --- a/shlibs/mount/src/Makefile.am +++ b/shlibs/mount/src/Makefile.am @@ -55,7 +55,7 @@ uninstall-hook: tests = test_version test_cache test_optstr test_lock \ - test_tab test_utils test_tab_update + test_tab test_utils test_tab_update test_context tests: all $(tests) test_%: %.c all diff --git a/shlibs/mount/src/context.c b/shlibs/mount/src/context.c index 59e8bd92..67915205 100644 --- a/shlibs/mount/src/context.c +++ b/shlibs/mount/src/context.c @@ -1049,6 +1049,9 @@ int mnt_context_merge_mountflags(mnt_context *cxt) return rc; cxt->user_mountflags = fl; + DBG(CXT, mnt_debug_h(cxt, "final flags: VFS=%08lx userspace=%08lx", + cxt->mountflags, cxt->user_mountflags)); + cxt->flags |= MNT_FL_MOUNTFLAGS_MERGED; return 0; } diff --git a/shlibs/mount/src/context_mount.c b/shlibs/mount/src/context_mount.c index b5a339f5..b66b060e 100644 --- a/shlibs/mount/src/context_mount.c +++ b/shlibs/mount/src/context_mount.c @@ -48,9 +48,6 @@ static int fix_optstr(mnt_context *cxt) fs = cxt->fs; - if (!mnt_fs_get_vfs_options(fs) && !mnt_fs_get_userspace_options(fs)) - return 0; - /* The propagation flags should not be used together with any other flags */ if (cxt->mountflags & MS_PROPAGATION) cxt->mountflags &= MS_PROPAGATION; diff --git a/shlibs/mount/src/fs.c b/shlibs/mount/src/fs.c index b8e9085d..61bad7fd 100644 --- a/shlibs/mount/src/fs.c +++ b/shlibs/mount/src/fs.c @@ -478,7 +478,7 @@ char *mnt_fs_strdup_options(mnt_fs *fs) errno = 0; res = merge_optstr(fs->vfs_optstr, fs->fs_optstr); - if (errno) + if (!res && errno) return NULL; if (fs->user_optstr) { if (mnt_optstr_append_option(&res, fs->user_optstr, NULL)) { diff --git a/shlibs/mount/src/tab_update.c b/shlibs/mount/src/tab_update.c index ad7c19d7..e474e514 100644 --- a/shlibs/mount/src/tab_update.c +++ b/shlibs/mount/src/tab_update.c @@ -151,6 +151,10 @@ int mnt_update_set_fs(mnt_update *upd, int mountflags, DBG(UPDATE, mnt_debug_h(upd, "reseting FS [fs=0x%p, target=%s, flags=0x%08x]", fs, target, mountflags)); + if (fs) { + DBG(UPDATE, mnt_debug_h(upd, "FS template:")); + DBG(UPDATE, mnt_fs_print_debug(fs, stderr)); + } mnt_free_fs(upd->fs); free(upd->target); @@ -683,6 +687,7 @@ int mnt_update_tab(mnt_update *upd, mnt_lock *lc) return 0; DBG(UPDATE, mnt_debug_h(upd, "%s: update tab", upd->filename)); + DBG(UPDATE, mnt_fs_print_debug(upd->fs, stderr)); if (!upd->fs && upd->target) rc = update_remove_entry(upd, lc); /* umount */ diff --git a/tests/ts/libmount/context b/tests/ts/libmount/context index 66e2dab0..536ab1b5 100755 --- a/tests/ts/libmount/context +++ b/tests/ts/libmount/context @@ -60,7 +60,6 @@ grep -q $DEVICE $LIBMOUNT_MTAB || \ echo "(by device) cannot found $DEVICE in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1 ts_finalize_subtest - ts_init_subtest "umount-by-devname" $TESTPROG --umount $DEVICE >> $TS_OUTPUT 2>&1 grep -q $DEVICE $LIBMOUNT_MTAB && -- 2.39.5