From 8eac2d517f199496484b11ee0a13a6f52c258a54 Mon Sep 17 00:00:00 2001 From: Lans Zhang Date: Sat, 26 Sep 2015 14:00:04 +0800 Subject: [PATCH] Fix getting back a wrong relpath If a device is mounted at more than one mount points, the relpath may be created with unexpected result because there is no compare before doing it. Resolvs #34 Signed-off-by: Lans Zhang Signed-off-by: Peter Jones --- src/creator.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/creator.c b/src/creator.c index 1244cb8..c33b935 100644 --- a/src/creator.c +++ b/src/creator.c @@ -116,6 +116,8 @@ find_file(const char * const filepath, char **devicep, char **relpathp) errno = ENAMETOOLONG; goto err; } + if (strncmp(linkbuf, me->mnt_dir, mntlen)) + continue; *devicep = strdup(me->mnt_fsname); if (!*devicep) goto err; -- 2.11.0