aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2000-12-15 22:25:51 +0000
committerChristopher Faylor <me@cgf.cx>2000-12-15 22:25:51 +0000
commit7fbcbc95929b933657d8b69673c42d1dd84408b0 (patch)
treee5d27bd05731cc4aed3b388e64e8855749068b0b
parent80d0051c3714bed2c2c922f23b907d6ba11b19da (diff)
downloadnewlib-7fbcbc95929b933657d8b69673c42d1dd84408b0.zip
newlib-7fbcbc95929b933657d8b69673c42d1dd84408b0.tar.gz
newlib-7fbcbc95929b933657d8b69673c42d1dd84408b0.tar.bz2
* 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.
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/Makefile.in5
-rw-r--r--winsup/cygwin/path.cc18
3 files changed, 20 insertions, 10 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 508f05d..98e33d6 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -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
diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in
index 37f4c96..18dbdc7 100644
--- a/winsup/cygwin/Makefile.in
+++ b/winsup/cygwin/Makefile.in
@@ -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
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 0584d03..69f6071 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -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);