diff options
author | Karel Zak | 2010-10-12 16:17:16 +0200 |
---|---|---|
committer | Karel Zak | 2011-01-03 12:28:45 +0100 |
commit | 1b56aae848a7b579b1841b6ec1e47f61f9fa2af7 (patch) | |
tree | 3f382b331832799f6db74b0fffb0860de625e519 /shlibs/mount/src/context_umount.c | |
parent | libmount: add umount(2) support (diff) | |
download | kernel-qcow2-util-linux-1b56aae848a7b579b1841b6ec1e47f61f9fa2af7.tar.gz kernel-qcow2-util-linux-1b56aae848a7b579b1841b6ec1e47f61f9fa2af7.tar.xz kernel-qcow2-util-linux-1b56aae848a7b579b1841b6ec1e47f61f9fa2af7.zip |
libmount: improve assert() and DBG() usage
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/mount/src/context_umount.c')
-rw-r--r-- | shlibs/mount/src/context_umount.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/shlibs/mount/src/context_umount.c b/shlibs/mount/src/context_umount.c index 1222fe6f9..b2590be94 100644 --- a/shlibs/mount/src/context_umount.c +++ b/shlibs/mount/src/context_umount.c @@ -28,6 +28,9 @@ static int lookup_umount_fs(mnt_context *cxt) mnt_tab *mtab; mnt_fs *fs; + assert(cxt); + assert(cxt->fs); + tgt = mnt_fs_get_target(cxt->fs); if (!tgt) { DBG(CXT, mnt_debug_h(cxt, "umount: undefined target")); @@ -135,6 +138,10 @@ static int evaluate_permissions(mnt_context *cxt) int rc, ok = 0; mnt_fs *fs; + assert(cxt); + assert(cxt->fs); + assert((cxt->flags & MNT_FL_MOUNTFLAGS_MERGED)); + if (!cxt || !cxt->fs) return -EINVAL; @@ -148,9 +155,9 @@ static int evaluate_permissions(mnt_context *cxt) goto eperm; } - mnt_context_get_userspace_mountflags(cxt, &u_flags); + if (!(cxt->flags & MNT_FL_NOHELPERS) && + (cxt->user_mountflags & MNT_MS_UHELPER)) { - if (!(cxt->flags & MNT_FL_NOHELPERS) && (u_flags & MNT_MS_UHELPER)) { char *suffix = NULL; char *o = (char *) mnt_fs_get_optstr(cxt->fs); size_t valsz; @@ -216,7 +223,7 @@ static int evaluate_permissions(mnt_context *cxt) * The options `user', `owner' and `group' only allow unmounting by the * user that mounted (visible in mtab). */ - optstr = mnt_fs_get_optstr(fs); + optstr = mnt_fs_get_optstr(fs); /* FSTAB mount options! */ if (!optstr) goto eperm; @@ -267,6 +274,7 @@ static int exec_helper(mnt_context *cxt) assert(cxt); assert(cxt->fs); assert(cxt->helper); + assert((cxt->flags & MNT_FL_MOUNTFLAGS_MERGED)); DBG_FLUSH; @@ -341,6 +349,7 @@ static int do_umount(mnt_context *cxt) assert(cxt); assert(cxt->fs); + assert((cxt->flags & MNT_FL_MOUNTFLAGS_MERGED)); if (cxt->helper) return exec_helper(cxt); @@ -432,6 +441,8 @@ int mnt_context_prepare_umount(mnt_context *cxt) rc = lookup_umount_fs(cxt); if (!rc) + rc = mnt_context_merge_mountflags(cxt); + if (!rc) rc = evaluate_permissions(cxt); if (!rc && !cxt->helper) rc = mnt_context_prepare_helper(cxt, "umount", NULL); |