# HG changeset patch # User james # Date 1066832220 0 # Node ID 0240ff815597b2cd12f9ea3df41a976c3fb069f9 # Parent a14f3af8e6fbcda5047ec753911443969bc6b969 [xemacs-hg @ 2003-10-22 14:16:58 by james] Fix Cygwin problem with resolving symbolic links to absolute pathnames. diff -r a14f3af8e6fb -r 0240ff815597 src/ChangeLog --- a/src/ChangeLog Tue Oct 21 23:49:42 2003 +0000 +++ b/src/ChangeLog Wed Oct 22 14:17:00 2003 +0000 @@ -1,3 +1,8 @@ +2003-10-16 Jerry James <james@xemacs.org> + + * realpath.c (qxe_realpath): When a symbolic link to an absolute + pathname is found, really start over. + 2003-10-21 Stephen J. Turnbull <stephen@xemacs.org> * bytecode.c (execute_optimized_program): diff -r a14f3af8e6fb -r 0240ff815597 src/realpath.c --- a/src/realpath.c Tue Oct 21 23:49:42 2003 +0000 +++ b/src/realpath.c Wed Oct 22 14:17:00 2003 +0000 @@ -180,6 +180,8 @@ int abslen = abs_start (path); #endif + restart: + /* Make a copy of the source path since we may need to modify it. */ qxestrcpy (copy_path, path); path = copy_path; @@ -320,13 +322,19 @@ /* Note: readlink doesn't add the null byte. */ link_path[n] = '\0'; - if (abs_start (link_path) > 0) - /* Start over for an absolute symlink. */ - new_path = resolved_path + abs_start (link_path) - 1; - else - /* Otherwise back up over this component. */ - for (--new_path; !IS_DIRECTORY_SEP (*new_path); --new_path) - assert (new_path > resolved_path); + abslen = abs_start (link_path); + if (abslen > 0) + { + /* Start over for an absolute symlink. */ + new_path = resolved_path; + qxestrcat (link_path, path); + path = link_path; + goto restart; + } + + /* Otherwise back up over this component. */ + for (--new_path; !IS_DIRECTORY_SEP (*new_path); --new_path) + assert (new_path > resolved_path); /* Safe sex check. */ if (qxestrlen (path) + n >= PATH_MAX)