diff src/fileio.c @ 357:4711e16a8e49 r21-1-8

Import from CVS: tag r21-1-8
author cvs
date Mon, 13 Aug 2007 10:57:04 +0200
parents 7c94d56991e1
children 8e84bee8ddd0
line wrap: on
line diff
--- a/src/fileio.c	Mon Aug 13 10:56:23 2007 +0200
+++ b/src/fileio.c	Mon Aug 13 10:57:04 2007 +0200
@@ -1299,18 +1299,18 @@
 
   {
     char resolved_path[MAXPATHLEN];
-    char path[MAXPATHLEN];
-    char *p = path;
+    char *path;
+    char *p;
     int elen = XSTRING_LENGTH (expanded_name);
 
-    if (elen >= countof (path))
+    GET_STRING_FILENAME_DATA_ALLOCA(expanded_name,path,elen);
+    p = path;
+    if (elen > MAXPATHLEN)
       goto toolong;
-
-    memcpy (path, XSTRING_DATA (expanded_name), elen + 1);
-    /* memset (resolved_path, 0, sizeof (resolved_path)); */
-
+    
     /* Try doing it all at once. */
-    /* !!#### Does realpath() Mule-encapsulate? */
+    /* !! Does realpath() Mule-encapsulate?
+       Answer: Nope! So we do it above */
     if (!xrealpath (path, resolved_path))
       {
 	/* Didn't resolve it -- have to do it one component at a time. */