diff options
author | Karel Zak | 2010-11-26 14:33:29 +0100 |
---|---|---|
committer | Karel Zak | 2011-01-03 12:28:46 +0100 |
commit | 766af80be1c76bbae78bf86ce0ae757082bb92fa (patch) | |
tree | 88b95682bbd0fbe7c73833b39f70f74d111bb2eb /shlibs/mount/src/context_umount.c | |
parent | libmount: use better format for utab, improve bind mounts (diff) | |
download | kernel-qcow2-util-linux-766af80be1c76bbae78bf86ce0ae757082bb92fa.tar.gz kernel-qcow2-util-linux-766af80be1c76bbae78bf86ce0ae757082bb92fa.tar.xz kernel-qcow2-util-linux-766af80be1c76bbae78bf86ce0ae757082bb92fa.zip |
libmount: fix to work with btrfs subvolume user mounts
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 | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/shlibs/mount/src/context_umount.c b/shlibs/mount/src/context_umount.c index 7cb4a2a44..ca9ca7749 100644 --- a/shlibs/mount/src/context_umount.c +++ b/shlibs/mount/src/context_umount.c @@ -138,7 +138,7 @@ static int mnt_loopdev_associated_fs(const char *devname, mnt_fs *fs) static int evaluate_permissions(mnt_context *cxt) { mnt_tab *fstab; - unsigned long u_flags; + unsigned long u_flags = 0; const char *tgt, *src, *optstr; int rc, ok = 0; mnt_fs *fs; @@ -243,9 +243,11 @@ static int evaluate_permissions(mnt_context *cxt) if (mnt_optstr_get_userspace_mountflags(optstr, &u_flags)) goto eperm; - if (u_flags & MNT_MS_USERS) - /* promiscuous setting in fstab */ + if (u_flags & MNT_MS_USERS) { + DBG(CXT, mnt_debug_h(cxt, + "umount: promiscuous setting ('users') in fstab")); return 0; + } /* * Check user=<username> setting from mtab if there is user, owner or * group option in /etc/fstab @@ -253,14 +255,18 @@ static int evaluate_permissions(mnt_context *cxt) if ((u_flags & MNT_MS_USER) || (u_flags & MNT_MS_OWNER) || (u_flags & MNT_MS_GROUP)) { - char *curr_user = mnt_get_username(getuid()); + char *curr_user = NULL; char *mtab_user = NULL; size_t sz; + DBG(CXT, mnt_debug_h(cxt, + "umount: checking user=<username> from mtab")); + + curr_user = mnt_get_username(getuid()); + if (!curr_user) { DBG(CXT, mnt_debug_h(cxt, "umount %s: cannot " - "convert %d to username", - tgt, getuid())); + "convert %d to username", tgt, getuid())); goto eperm; } |