diff options
-rw-r--r-- | shlibs/mount/src/context.c | 54 | ||||
-rw-r--r-- | shlibs/mount/src/context_mount.c | 2 | ||||
-rw-r--r-- | shlibs/mount/src/mount.h.in | 3 |
3 files changed, 20 insertions, 39 deletions
diff --git a/shlibs/mount/src/context.c b/shlibs/mount/src/context.c index 3863629c..3ab5a737 100644 --- a/shlibs/mount/src/context.c +++ b/shlibs/mount/src/context.c @@ -1079,10 +1079,12 @@ int mnt_context_update_tabs(mnt_context *cxt) assert(cxt); - if (cxt->flags & MNT_FL_NOMTAB) + if ((cxt->flags & MNT_FL_NOMTAB) && cxt->helper) return 0; if (!cxt->update || !mnt_update_is_ready(cxt->update)) return 0; + if (cxt->syscall_status) + return 0; if (mnt_update_is_userspace_only(cxt->update)) filename = cxt->utab_path; @@ -1264,10 +1266,8 @@ mnt_lock *lock; static void lock_fallback(void) { - if (lock) { + if (lock) mnt_unlock_file(lock); - mnt_free_lock(lock); - } } int test_mount(struct mtest *ts, int argc, char *argv[]) @@ -1302,24 +1302,13 @@ int test_mount(struct mtest *ts, int argc, char *argv[]) mnt_context_set_target(cxt, argv[idx++]); } - rc = mnt_context_prepare_mount(cxt); - if (rc) - printf("failed to prepare mount\n"); - else { - lock = mnt_context_get_lock(cxt); - if (lock) - atexit(lock_fallback); + lock = mnt_context_get_lock(cxt); + if (lock) + atexit(lock_fallback); - rc = mnt_context_do_mount(cxt); - if (rc) - printf("failed to mount\n"); - else { - printf("successfully mounted\n"); - rc = mnt_context_post_mount(cxt); - if (rc) - printf("mtab update failed\n"); - } - } + rc = mnt_context_do_mount(cxt); + if (rc) + printf("failed to mount %s\n", strerror(errno)); mnt_free_context(cxt); return rc; @@ -1365,24 +1354,13 @@ int test_umount(struct mtest *ts, int argc, char *argv[]) goto err; } - rc = mnt_context_prepare_umount(cxt); - if (rc) - printf("failed to prepare umount\n"); - else { - lock = mnt_context_get_lock(cxt); - if (lock) - atexit(lock_fallback); + lock = mnt_context_get_lock(cxt); + if (lock) + atexit(lock_fallback); - rc = mnt_context_do_umount(cxt); - if (rc) - printf("failed to umount\n"); - else { - printf("successfully umounted\n"); - rc = mnt_context_post_umount(cxt); - if (rc) - printf("mtab update failed\n"); - } - } + rc = mnt_context_do_umount(cxt); + if (rc) + printf("failed to umount\n"); err: mnt_free_context(cxt); return rc; diff --git a/shlibs/mount/src/context_mount.c b/shlibs/mount/src/context_mount.c index 070d72f1..7b0a9c12 100644 --- a/shlibs/mount/src/context_mount.c +++ b/shlibs/mount/src/context_mount.c @@ -377,6 +377,7 @@ static int do_mount_by_pattern(mnt_context *cxt, const char *pattern) char **filesystems, **fp; assert(cxt); + assert((cxt->flags & MNT_FL_MOUNTFLAGS_MERGED)); if (!neg && pattern) { /* @@ -436,7 +437,6 @@ int mnt_context_do_mount(mnt_context *cxt) assert(cxt); assert(cxt->fs); - assert((cxt->flags & MNT_FL_MOUNTFLAGS_MERGED)); assert(cxt->helper_exec_status == 1); assert(cxt->syscall_status == 1); diff --git a/shlibs/mount/src/mount.h.in b/shlibs/mount/src/mount.h.in index 5553921e..11231719 100644 --- a/shlibs/mount/src/mount.h.in +++ b/shlibs/mount/src/mount.h.in @@ -350,6 +350,9 @@ extern int mnt_context_set_mountdata(mnt_context *cxt, void *data); extern int mnt_context_apply_fstab(mnt_context *cxt); extern int mnt_context_get_status(mnt_context *cxt); +extern int mnt_context_do_mount(mnt_context *cxt); +extern int mnt_context_do_umount(mnt_context *cxt); + /* * mount(8) userspace options masks (MNT_MAP_USERSPACE map) */ |