mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
-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. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39929 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2924bad7ff
commit
40bfca6870
1 changed files with 6 additions and 6 deletions
|
@ -4973,7 +4973,7 @@ static NSFileManager *fm = nil;
|
|||
{
|
||||
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 @@ static NSFileManager *fm = nil;
|
|||
}
|
||||
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 @@ static NSFileManager *fm = nil;
|
|||
|
||||
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 @@ static NSFileManager *fm = nil;
|
|||
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue