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 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> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline 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;