+2012-12-10 Eli Zaretskii <eliz@gnu.org>
+
+ canonicalize, canonicalize-lgpl: Microsoft Windows prefix fixes
+ * lib/canonicalize.c (canonicalize_filename_mode):
+ * lib/canonicalize-lgpl.c (__realpath): Recompute prefix_len after
+ fetching the current directory. Don't overrun the beginning of
+ rpath if there's no slashes after the MS-Windows drive letter.
+
2012-12-08 Stefano Lattarini <stefano.lattarini@gmail.com>
maint.mk: avoid extra forks
goto error;
}
dest = strchr (rpath, '\0');
+ start = name;
+ prefix_len = FILE_SYSTEM_PREFIX_LEN (rpath);
}
else
{
*dest++ = '/';
*dest = '\0';
}
+ start = name + prefix_len;
}
- for (start = end = name + prefix_len; *start; start = end)
+ for (end = start; *start; start = end)
{
#ifdef _LIBC
struct stat64 st;
{
/* Back up to previous component, ignore if at root already. */
if (dest > rpath + prefix_len + 1)
- for (--dest; !ISSLASH (dest[-1]); --dest)
+ for (--dest; dest > rpath && !ISSLASH (dest[-1]); --dest)
continue;
if (DOUBLE_SLASH_IS_DISTINCT_ROOT
&& dest == rpath + 1 && !prefix_len
/* Back up to previous component, ignore if at root
already: */
if (dest > rpath + prefix_len + 1)
- for (--dest; !ISSLASH (dest[-1]); --dest)
+ for (--dest; dest > rpath && !ISSLASH (dest[-1]); --dest)
continue;
if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rpath + 1
&& ISSLASH (*dest) && !ISSLASH (dest[1]) && !prefix_len)
{
rname_limit = dest;
}
+ start = name;
+ prefix_len = FILE_SYSTEM_PREFIX_LEN (rname);
}
else
{
*dest++ = '/';
*dest = '\0';
}
+ start = name + prefix_len;
}
- for (start = name + prefix_len; *start; start = end)
+ for ( ; *start; start = end)
{
/* Skip sequence of multiple file name separators. */
while (ISSLASH (*start))
{
/* Back up to previous component, ignore if at root already. */
if (dest > rname + prefix_len + 1)
- for (--dest; !ISSLASH (dest[-1]); --dest)
+ for (--dest; dest > rname && !ISSLASH (dest[-1]); --dest)
continue;
if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rname + 1
&& !prefix_len && ISSLASH (*dest) && !ISSLASH (dest[1]))
/* Back up to previous component, ignore if at root
already: */
if (dest > rname + prefix_len + 1)
- for (--dest; !ISSLASH (dest[-1]); --dest)
+ for (--dest; dest > rname && !ISSLASH (dest[-1]); --dest)
continue;
if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rname + 1
&& ISSLASH (*dest) && !ISSLASH (dest[1]) && !prefix_len)