OSDN Git Service

Fix getting back a wrong relpath
authorLans Zhang <jia.zhang@windriver.com>
Sat, 26 Sep 2015 06:00:04 +0000 (14:00 +0800)
committerPeter Jones <pjones@redhat.com>
Mon, 5 Oct 2015 14:50:55 +0000 (10:50 -0400)
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 <jia.zhang@windriver.com>
Signed-off-by: Peter Jones <pjones@redhat.com>
src/creator.c

index 1244cb8..c33b935 100644 (file)
@@ -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;