mirror of
https://gitdl.cn/https://github.com/chakralinux/core.git
synced 2025-02-13 23:49:16 +08:00
56 lines
1.6 KiB
Diff
56 lines
1.6 KiB
Diff
From 6eba938376c2c870d9258ef9d7b6a3690cfa78dd Mon Sep 17 00:00:00 2001
|
|
From: Karel Zak <kzak@redhat.com>
|
|
Date: Fri, 24 Feb 2012 22:52:45 +0100
|
|
Subject: [PATCH 11/12] libmount: canonicalize targets from fstab on mount -a
|
|
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
---
|
|
libmount/src/tab.c | 10 ++++++----
|
|
1 file changed, 6 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/libmount/src/tab.c b/libmount/src/tab.c
|
|
index 66a9e4d..21b05c7 100644
|
|
--- a/libmount/src/tab.c
|
|
+++ b/libmount/src/tab.c
|
|
@@ -830,8 +830,8 @@ int mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_fs)
|
|
{
|
|
char *root = NULL;
|
|
struct libmnt_fs *src_fs;
|
|
- const char *src, *tgt;
|
|
- char *xsrc = NULL;
|
|
+ const char *src;
|
|
+ char *xsrc = NULL, *tgt;
|
|
int flags = 0, rc = 0;
|
|
|
|
assert(tb);
|
|
@@ -852,7 +852,7 @@ int mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_fs)
|
|
src = xsrc = mnt_resolve_spec(mnt_fs_get_source(fstab_fs),
|
|
tb->cache);
|
|
|
|
- tgt = mnt_fs_get_target(fstab_fs);
|
|
+ tgt = mnt_resolve_path(mnt_fs_get_target(fstab_fs), tb->cache);
|
|
|
|
if (tgt && src && root) {
|
|
struct libmnt_iter itr;
|
|
@@ -870,7 +870,7 @@ int mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_fs)
|
|
* network filesystem source paths.
|
|
*/
|
|
if (t && s && r &&
|
|
- strcmp(t, tgt) == 0 &&
|
|
+ streq_except_trailing_slash(t, tgt) &&
|
|
streq_except_trailing_slash(s, src) &&
|
|
strcmp(r, root) == 0)
|
|
break;
|
|
@@ -881,6 +881,8 @@ int mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_fs)
|
|
|
|
if (xsrc && !tb->cache)
|
|
free(xsrc);
|
|
+ if (!tb->cache)
|
|
+ free(tgt);
|
|
|
|
free(root);
|
|
return rc;
|
|
--
|
|
1.7.9.2
|
|
|