delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2008/06/17/07:53:11

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
X-Authenticated: #27081556
X-Provags-ID: V01U2FsdGVkX1/4tEBWnZf4/MIhexbqwRh5dXfFusjL+gTdns5N/e
6YGxUPlWbIm75L
From: Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de>
To: djgpp-workers AT delorie DOT com
Subject: Re: What are usefull errno values produced by readdiir?
Date: Tue, 17 Jun 2008 13:54:07 +0200
User-Agent: KMail/1.9.5
References: <200806171146 DOT 59903 DOT juan DOT guerrero AT gmx DOT de> <d1e3ff2b0806170321w4769e093ocd3661f7a9a3f8ac AT mail DOT gmail DOT com> <d1e3ff2b0806170349h452b83a8y2472d4913a81bba6 AT mail DOT gmail DOT com>
In-Reply-To: <d1e3ff2b0806170349h452b83a8y2472d4913a81bba6@mail.gmail.com>
MIME-Version: 1.0
Message-Id: <200806171354.09943.juan.guerrero@gmx.de>
X-Y-GMX-Trusted: 0
Reply-To: djgpp-workers AT delorie DOT com

Am Dienstag, 17. Juni 2008 12:49 schrieb Laurynas Biveinis:
> I am the author of symlink code (heh, it's been nine years...) I don't
> remember any details, but it looks like that I've introduced this
> issue. If the file size is 510 bytes, the code should check if it's
> really a symlink, but if it is not, then the old errno value should be
> preserved.
> 

Agreed, the errno should be preserved in the symlink testing code.  Applied the
following fix.

Regards,
Juan M. Guerrero


Index: src/libc/posix/dirent/readdir.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/dirent/readdir.c,v
retrieving revision 1.5
diff -p -U5 -r1.5 readdir.c
--- src/libc/posix/dirent/readdir.c	17 Oct 2001 05:08:39 -0000	1.5
+++ src/libc/posix/dirent/readdir.c	17 Jun 2008 11:48:04 -0000
@@ -106,10 +106,11 @@ readdir(DIR *dir)
 	  char sbuf[_SYMLINK_FILE_LEN];
 
 	  if (__internal_readlink(NULL, fhandle, sbuf, _SYMLINK_FILE_LEN) > 0)
 	    dir->de.d_type = DT_LNK;
 	  _close(fhandle);
+          errno = oerrno;
 	}
       }
       /* FIXME: anything else DOS can return? */
       else
 	dir->de.d_type = DT_REG;

- Raw text -


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