delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/08/14/17:12:11

Message-ID: <399860D1.AAE46C76@softhome.net>
Date: Mon, 14 Aug 2000 23:12:49 +0200
From: Laurynas Biveinis <lauras AT softhome DOT net>
X-Mailer: Mozilla 4.74 [en] (Win98; U)
X-Accept-Language: lt,en
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: <limits.h> change for symlinks
References: <200008142028 DOT WAA25681 AT father DOT ludd DOT luth DOT se>
Reply-To: djgpp-workers AT delorie DOT com

Martin Str|mberg wrote:

[...examples of symlink resolving code...]

> So Linux doesn't even bother with a define!

But we want to be better, right? ;-)

Anyway, I've checked in the following fix to __solve_symlinks:
Laurynas

Index: xsymlink.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/compat/unistd/xsymlink.c,v
retrieving revision 1.1
diff -u -r1.1 xsymlink.c
--- xsymlink.c	2000/08/14 08:51:30	1.1
+++ xsymlink.c	2000/08/14 21:10:51
@@ -15,6 +15,11 @@
 
 #include "xsymlink.h"
 
+/* How many levels of symbolic links process before thinking 
+ * that we've found a link loop. 
+ */
+#define MAX_SYMLINK 8
+
 int __solve_symlinks(const char * __symlink_path, char * __real_path)
 {
    int    bytes_copied;
@@ -94,7 +99,7 @@
             }
          }
       } while ((bytes_copied != -1) && (link_level <= _POSIX_LINK_MAX));
-      if (link_level > _POSIX_LINK_MAX)
+      if (link_level > MAX_SYMLINK)
       {
          errno = ELOOP;
          return 0;

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019