Date: Tue, 9 Mar 1999 00:49:10 +0100 From: Frank Heckenbach Message-Id: <12EF1A9E.19990309004910.FOO-3D28.frank@goedel.fjf.gnu.de> X-Mailer: smtphack 0.3.3 by Jan Andres To: djgpp AT delorie DOT com, peter AT gerwinski DOT de Subject: Patch for select() X-Counter: 886 peter AT gerwinski DOT de Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=iso-8859-1 Reply-To: djgpp AT delorie DOT com Hello again, sorry, the last patch was not enough. Here's the next try: *** src/libc/compat/time/select.c.orig Sun Sep 27 15:18:24 1998 --- src/libc/compat/time/select.c Tue Mar 9 00:45:21 1999 *************** *** 47,54 **** if (fp->_cnt) return 1; ! /* The `feof' part is only correct in a single-tasked environment. */ ! if (ferror (fp) || feof (fp)) return 0; /* There is nothing in the buffer (perhaps because we read unbuffered). --- 47,53 ---- if (fp->_cnt) return 1; ! if (ferror (fp)) return 0; /* There is nothing in the buffer (perhaps because we read unbuffered). *************** *** 83,88 **** --- 82,101 ---- { __dpmi_regs regs; + + /* If it's a disk file, always return 1, since according to Un*x + semantics, select() returns ``ready'' at EOF (and before EOF, + anyway). */ + regs.x.ax = 0x4400; + regs.x.bx = fd; + __dpmi_int (0x21, ®s); + if (regs.x.flags & 1) + { + errno = __doserr_to_errno (regs.x.ax); + return -1; + } + if (!(regs.x.dx & 0x80)) + return 1; regs.x.ax = 0x4406; regs.x.bx = fd;