summaryrefslogtreecommitdiffstats
path: root/libmount/src/context_umount.c
diff options
context:
space:
mode:
authorKarel Zak2013-08-05 15:24:30 +0200
committerKarel Zak2013-08-05 15:35:39 +0200
commit68c41a5f5f2649f49d6eb2aecba7fb248b57e91e (patch)
treeb863f762b44f2175d101e070adb37fd0ba91d368 /libmount/src/context_umount.c
parentlosetup: make -j <path> more robust (diff)
downloadkernel-qcow2-util-linux-68c41a5f5f2649f49d6eb2aecba7fb248b57e91e.tar.gz
kernel-qcow2-util-linux-68c41a5f5f2649f49d6eb2aecba7fb248b57e91e.tar.xz
kernel-qcow2-util-linux-68c41a5f5f2649f49d6eb2aecba7fb248b57e91e.zip
libmount: be robust when work with loopdev backing file paths
It's usually unnecessary as we compare devno and ino, but let's use absolute paths for situations when it's necessary to compare paths as strings. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/context_umount.c')
-rw-r--r--libmount/src/context_umount.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c
index b02902c45..2e912c0dc 100644
--- a/libmount/src/context_umount.c
+++ b/libmount/src/context_umount.c
@@ -162,11 +162,9 @@ try_loopdev:
if (stat(tgt, &st) == 0 && S_ISREG(st.st_mode)) {
int count;
+ const char *bf = cache ? mnt_resolve_path(tgt, cache) : tgt;
- cn_tgt = mnt_resolve_path(tgt, cache);
- count = loopdev_count_by_backing_file(cn_tgt, &loopdev);
- if (!cache)
- free(cn_tgt);
+ count = loopdev_count_by_backing_file(bf, &loopdev);
if (count == 1) {
DBG(CXT, mnt_debug_h(cxt,
"umount: %s --> %s (retry)", tgt, loopdev));
@@ -361,7 +359,9 @@ static int evaluate_permissions(struct libmnt_context *cxt)
*/
fs = mnt_table_find_target(fstab, tgt, MNT_ITER_FORWARD);
if (fs) {
- const char *dev = mnt_fs_get_srcpath(cxt->fs); /* devname from mtab */
+ struct libmnt_cache *cache = mnt_context_get_cache(cxt);
+ const char *sp = mnt_fs_get_srcpath(cxt->fs); /* devname from mtab */
+ const char *dev = sp && cache ? mnt_resolve_path(sp, cache) : sp;
if (!dev || !is_associated_fs(dev, fs))
fs = NULL;