When traversing the path backwards to find the mount point, if the
root '/' is reached, then the character to be restored is not a '/'.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12273
Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Oct 8 05:22:25 CEST 2016 on sn-devel-144
}
while (true) {
+ char save_ch;
+
p = strrchr(stat_mntpath, '/');
if (p == NULL) {
DBG_ERR("realpath for %s does not begin with a '/'\n",
++p;
}
+ save_ch = *p;
*p = 0;
if (sys_stat(stat_mntpath, &S, false) != 0) {
DBG_WARNING("cannot stat real path component %s - %s\n",
goto out;
}
if (S.st_ex_dev != devno) {
- *p = '/';
+ *p = save_ch;
break;
}