Date: Fri, 07 Mar 2003 16:57:59 +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: _write_fill_seek_gap: Bug in checking for non-files [PATCH] Message-Id: Reply-To: djgpp-workers AT delorie DOT com Hello. There's a bug in _write_fill_seek_gap that prevents the zero-fill from working for files with file descriptors that bits 0-2 set. The code is trying to avoid zero-fill for character devices, where it's not applicable. But it does not check that the device info has the character device bit set (_DEV_CDEV == 0x80). Below is a patch that fixes this problem. OK to commit? Bye, Rich =] Index: src/libc/dos/io/_write.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/dos/io/_write.c,v retrieving revision 1.9 diff -p -c -3 -r1.9 _write.c *** src/libc/dos/io/_write.c 29 Jan 2003 01:19:45 -0000 1.9 --- src/libc/dos/io/_write.c 7 Mar 2003 16:44:12 -0000 *************** _write_fill_seek_gap(int fd) *** 57,63 **** /* Quit when not working with a file. */ fd_info = _get_dev_info(fd); ! if (fd_info & (_DEV_STDIN | _DEV_STDOUT | _DEV_NUL)) { /* Don't bother with handles that don't need the fix. */ __set_fd_flags(fd, FILE_DESC_DONT_FILL_EOF_GAP); --- 57,63 ---- /* Quit when not working with a file. */ fd_info = _get_dev_info(fd); ! if (fd_info & _DEV_CDEV) { /* Don't bother with handles that don't need the fix. */ __set_fd_flags(fd, FILE_DESC_DONT_FILL_EOF_GAP);