* path.cc (normalize_posix_path): Calculate path name length overruns more

dynamically.
(normalize_win32_path): Ditto.
* Makefile.in: Avoid scanning the directory twice for *.d files.
This commit is contained in:
Christopher Faylor 2000-12-15 22:25:51 +00:00
parent 80d0051c37
commit 7fbcbc9592
3 changed files with 20 additions and 10 deletions

View File

@ -1,3 +1,10 @@
Fri Dec 15 17:23:17 2000 Christopher Faylor <cgf@cygnus.com>
* path.cc (normalize_posix_path): Calculate path name length overruns
more dynamically.
(normalize_win32_path): Ditto.
* Makefile.in: Avoid scanning the directory twice for *.d files.
Thu Dec 14 23:37:51 2000 Christopher Faylor <cgf@cygnus.com>
* fhandler.h (fhandler_console): Add additional argument to

View File

@ -219,6 +219,7 @@ $(DEF_FILE): cygwin.din config.status
winsup.h: config.h
ifneq (,${wildcard *.d})
include *.d
deps:=${wildcard *.d}
ifneq (,$(deps))
include $(deps)
endif

View File

@ -608,11 +608,6 @@ normalize_posix_path (const char *src, char *dst)
{
if (!cygcwd.get (dst))
return get_errno ();
if (strlen (dst) + 1 + strlen (src) >= MAX_PATH)
{
debug_printf ("ENAMETOOLONG = normalize_posix_path (%s)", src);
return ENAMETOOLONG;
}
dst = strchr (dst, '\0');
if (*src == '.')
{
@ -647,6 +642,8 @@ normalize_posix_path (const char *src, char *dst)
strcpy (dst, cygheap->root.path ());
dst += cygheap->root.length ();
}
else
*dst = '\0';
while (*src)
{
@ -689,6 +686,11 @@ normalize_posix_path (const char *src, char *dst)
*dst++ = '/';
}
if ((dst - dst_start) >= MAX_PATH)
{
debug_printf ("ENAMETOOLONG = normalize_posix_path (%s)", src);
return ENAMETOOLONG;
}
}
done:
@ -768,9 +770,7 @@ normalize_win32_path (const char *src, char *dst)
/* Ignore "./". */
else if (src[0] == '.' && SLASH_P (src[1])
&& (src == src_start || SLASH_P (src[-1])))
{
src += 2;
}
src += 2;
/* Backup if "..". */
else if (src[0] == '.' && src[1] == '.'
@ -797,6 +797,8 @@ normalize_win32_path (const char *src, char *dst)
*dst++ = *src;
++src;
}
if ((dst - dst_start) >= MAX_PATH)
return ENAMETOOLONG;
}
*dst = 0;
debug_printf ("%s = normalize_win32_path (%s)", dst_start, src_start);