Mail Archives: djgpp-workers/2008/06/17/07:53:11
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 -