Message-ID: <399A695C.1213BB11@softhome.net> Date: Wed, 16 Aug 2000 12:13:48 +0200 From: Laurynas Biveinis X-Mailer: Mozilla 4.74 [en] (Win98; U) X-Accept-Language: lt,en MIME-Version: 1.0 To: DJGPP Workers Subject: Patch: file sharing in readlink() Content-Type: text/plain; charset=iso-8859-4 Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Here is the change for readlink() based on Eli's comments and open() code. Any comments? Laurynas Index: readlink.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/compat/unistd/readlink.c,v retrieving revision 1.1 diff -u -r1.1 readlink.c --- readlink.c 2000/08/11 11:16:24 1.1 +++ readlink.c 2000/08/16 10:15:43 @@ -45,7 +45,17 @@ /* Now we check for special DJGPP symlink format */ fd = _open(filename, O_RDONLY); if (fd < 0) - return -1; /* errno from open() call */ + { + /* Retry with DENY-NONE share bit set. It might help in some cases + * when symlink file is opened by another program. We don't try with + * DENY-NONE set in the first _open() call, because it might fail under + * some circumstances. For details, see Ralf Brown's Interrupt List, + * description of INT 0x21, function 0x3D. + */ + fd = _open(filename, O_RDONLY | SH_DENYNO); + if (fd < 0) + return -1; /* errno from open() call */ + } bytes_read = read(fd, &buf, _SYMLINK_FILE_LEN); _close(fd);