Author: rfm
Date: Mon Jun 27 13:52:31 2016
New Revision: 39929
URL: http://svn.gna.org/viewcvs/gnustep?rev=39929&view=rev
Log:
-stringByResolvingSymlinksInPath should return the expanded string rather than
the original string on failure of link resolution. The tilde should get
expanded even if the resulting directory does not actually exist.
Modified:
libs/base/trunk/Source/NSString.m
Modified: libs/base/trunk/Source/NSString.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/NSString.m?rev=39929&r1=39928&r2=39929&view=diff
==============================================================================
--- libs/base/trunk/Source/NSString.m (original)
+++ libs/base/trunk/Source/NSString.m Mon Jun 27 13:52:31 2016
@@ -4973,7 +4973,7 @@
{
if (!getcwd(newBuf, PATH_MAX))
{
- return IMMUTABLE(self); /* Couldn't get directory. */
+ return IMMUTABLE(s); /* Couldn't get directory. */
}
dest = strchr(newBuf, '\0');
}
@@ -5031,7 +5031,7 @@
}
if (&dest[len] >= &newBuf[PATH_MAX])
{
- return IMMUTABLE(self); /* Resolved name too long. */
+ return IMMUTABLE(s); /* Resolved name too long. */
}
memmove(dest, start, len);
dest += len;
@@ -5039,7 +5039,7 @@
if (lstat(newBuf, &st) < 0)
{
- return IMMUTABLE(self); /* Unable to stat file. */
+ return IMMUTABLE(s); /* Unable to stat file. */
}
if (S_ISLNK(st.st_mode))
{
@@ -5048,19 +5048,19 @@
if (++num_links > GS_MAXSYMLINKS)
{
- return IMMUTABLE(self); /* Too many links. */
+ return IMMUTABLE(s); /* Too many links. */
}
n = readlink(newBuf, buf, PATH_MAX);
if (n < 0)
{
- return IMMUTABLE(self); /* Couldn't resolve. */
+ return IMMUTABLE(s); /* Couldn't resolve. */
}
buf[n] = '\0';
l = strlen(end);
if ((n + l) >= PATH_MAX)
{
- return IMMUTABLE(self); /* Path too long. */
+ return IMMUTABLE(s); /* Path too long. */
}
/*
* Concatenate the resolved name with the string still to
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs