Date: Fri, 07 Mar 2003 16:59:47 +0000 From: "Richard Dawe" Sender: rich AT phekda DOT freeserve DOT co DOT uk To: djgpp-workers AT delorie DOT com X-Mailer: Emacs 21.3.50 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.6 Subject: lseek code & doc fixes [PATCH] Message-Id: Reply-To: djgpp-workers AT delorie DOT com Hello. The recent refactoring of lseek to use llseek seems to have introduced a bug. Namely: the error checking checks the wrong variable, to see if llseek failed. The lseek docs also don't mention the possibility that it can fail. The patch below fixes these. OK to commit? Bye, Rich =] Index: src/libc/posix/unistd/lseek.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/posix/unistd/lseek.c,v retrieving revision 1.7 diff -p -c -3 -r1.7 lseek.c *** src/libc/posix/unistd/lseek.c 25 Jan 2003 12:24:11 -0000 1.7 --- src/libc/posix/unistd/lseek.c 7 Mar 2003 16:44:34 -0000 *************** lseek(int handle, off_t offset, int when *** 28,34 **** } llseek_offset = llseek(handle, offset, whence); ! if( offset == -1 ) { return -1; /* llseek sets errno. */ } --- 28,34 ---- } llseek_offset = llseek(handle, offset, whence); ! if( llseek_offset == -1 ) { return -1; /* llseek sets errno. */ } Index: src/libc/posix/unistd/lseek.txh =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/posix/unistd/lseek.txh,v retrieving revision 1.5 diff -p -c -3 -r1.5 lseek.txh *** src/libc/posix/unistd/lseek.txh 29 Jan 2003 12:51:41 -0000 1.5 --- src/libc/posix/unistd/lseek.txh 7 Mar 2003 16:44:37 -0000 *************** case. *** 34,40 **** @subheading Return Value ! The new offset is returned. @subheading Portability --- 34,40 ---- @subheading Return Value ! The new offset is returned, or -1 and @code{errno} set on failure. @subheading Portability