On GLIBC and FreeBSD use sysconf(_SC_SYMLOOP_MAX) instead of just MAXSYMLINKS.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37665 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Riccardo Mottola 2014-02-02 00:47:01 +00:00
parent 79c0e271b3
commit ab3f7c47d8
2 changed files with 14 additions and 1 deletions

View file

@ -1,3 +1,10 @@
2014-02-02 Riccardo Mottola <rm@gnu.org>
* Source/NSString.m (stringByResolvingSymlinksInPath)
On GLIBC and FreeBSD use sysconf(_SC_SYMLOOP_MAX) instead of just
MAXSYMLINKS. For HURD this is necessary, since the latter is not
defined.
2014-01-31 Marcus Mueller <znek@mulle-kybernetik.com>
* Source/NSUserNotification.m:

View file

@ -4558,6 +4558,12 @@ static NSFileManager *fm = nil;
#else
{
#if defined(__GLIBC__) || defined(__FreeBSD__)
#define GS_MAXSYMLINKS sysconf(_SC_SYMLOOP_MAX)
#else
#define GS_MAXSYMLINKS MAXSYMLINKS
#endif
#ifndef PATH_MAX
#define PATH_MAX 1024
/* Don't use realpath unless we know we have the correct path size limit */
@ -4655,7 +4661,7 @@ static NSFileManager *fm = nil;
char buf[PATH_MAX];
int l;
if (++num_links > MAXSYMLINKS)
if (++num_links > GS_MAXSYMLINKS)
{
return IMMUTABLE(self); /* Too many links. */
}