diff options
author | Karel Zak | 2012-02-24 22:52:45 +0100 |
---|---|---|
committer | Karel Zak | 2012-02-24 22:52:45 +0100 |
commit | 6eba938376c2c870d9258ef9d7b6a3690cfa78dd (patch) | |
tree | 32a283e5d852c25c99ae4df1d1dad144329f06f1 /libmount/src/tab.c | |
parent | libmount: optimize for paths with tailing slash (diff) | |
download | kernel-qcow2-util-linux-6eba938376c2c870d9258ef9d7b6a3690cfa78dd.tar.gz kernel-qcow2-util-linux-6eba938376c2c870d9258ef9d7b6a3690cfa78dd.tar.xz kernel-qcow2-util-linux-6eba938376c2c870d9258ef9d7b6a3690cfa78dd.zip |
libmount: canonicalize targets from fstab on mount -a
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/tab.c')
-rw-r--r-- | libmount/src/tab.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libmount/src/tab.c b/libmount/src/tab.c index 66a9e4dcd..21b05c705 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; |