Date: Mon, 17 Mar 1997 13:15:59 +0100 (MET) From: Robert Hoehne To: DJGPP workers Subject: Patch fro lock.c and unlock.c Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII During my work for a program, which should run even on a network, I found a little bug in lock() and unlock(). The problem is the wrong error code in errno and I think that the patch explains it enough. *** src/libc/dos/io/lock.c~ Sat Apr 1 23:18:18 1995 --- src/libc/dos/io/lock.c Sun Mar 16 22:32:24 1997 *************** *** 1,17 **** /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ #include #include int lock(int fd, long offset, long length) { int ret = _dos_lock(fd, offset, length); /* change return code because Borland does it this way */ if (ret == 0x21) ret = EACCES; if (ret != 0) { ! errno = ret; return -1; } else --- 1,20 ---- /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ #include #include + #include int lock(int fd, long offset, long length) { int ret = _dos_lock(fd, offset, length); + #if 0 /* __doserr_to_errno does the same */ /* change return code because Borland does it this way */ if (ret == 0x21) ret = EACCES; + #endif if (ret != 0) { ! errno = __doserr_to_errno(ret); return -1; } else *** src/libc/dos/io/unlock.c~ Sat Apr 1 23:18:18 1995 --- src/libc/dos/io/unlock.c Sun Mar 16 22:32:08 1997 *************** *** 1,17 **** /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ #include #include int unlock(int fd, long offset, long length) { int ret = _dos_unlock(fd, offset, length); /* change return code because Borland does it this way */ if (ret == 0x21) ret = EACCES; if (ret != 0) { ! errno = ret; return -1; } else --- 1,20 ---- /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ #include #include + #include int unlock(int fd, long offset, long length) { int ret = _dos_unlock(fd, offset, length); + #if 0 /* __doserr_to_errno does the same */ /* change return code because Borland does it this way */ if (ret == 0x21) ret = EACCES; + #endif if (ret != 0) { ! errno = __doserr_to_errno(ret); return -1; } else Robert