comparison 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
comparison
equal deleted inserted replaced
356:e85f639a32f3 357:4711e16a8e49
1297 if (!NILP (handler)) 1297 if (!NILP (handler))
1298 return call2_check_string (handler, Qfile_truename, expanded_name); 1298 return call2_check_string (handler, Qfile_truename, expanded_name);
1299 1299
1300 { 1300 {
1301 char resolved_path[MAXPATHLEN]; 1301 char resolved_path[MAXPATHLEN];
1302 char path[MAXPATHLEN]; 1302 char *path;
1303 char *p = path; 1303 char *p;
1304 int elen = XSTRING_LENGTH (expanded_name); 1304 int elen = XSTRING_LENGTH (expanded_name);
1305 1305
1306 if (elen >= countof (path)) 1306 GET_STRING_FILENAME_DATA_ALLOCA(expanded_name,path,elen);
1307 p = path;
1308 if (elen > MAXPATHLEN)
1307 goto toolong; 1309 goto toolong;
1308 1310
1309 memcpy (path, XSTRING_DATA (expanded_name), elen + 1);
1310 /* memset (resolved_path, 0, sizeof (resolved_path)); */
1311
1312 /* Try doing it all at once. */ 1311 /* Try doing it all at once. */
1313 /* !!#### Does realpath() Mule-encapsulate? */ 1312 /* !! Does realpath() Mule-encapsulate?
1313 Answer: Nope! So we do it above */
1314 if (!xrealpath (path, resolved_path)) 1314 if (!xrealpath (path, resolved_path))
1315 { 1315 {
1316 /* Didn't resolve it -- have to do it one component at a time. */ 1316 /* Didn't resolve it -- have to do it one component at a time. */
1317 /* "realpath" is a typically useless, stupid un*x piece of crap. 1317 /* "realpath" is a typically useless, stupid un*x piece of crap.
1318 It claims to return a useful value in the "error" case, but since 1318 It claims to return a useful value in the "error" case, but since