*BSD News Article 43049


Return to BSD News archive

Newsgroups: comp.os.386bsd.bugs
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!news.hawaii.edu!ames!hookup!swrinde!howland.reston.ans.net!Germany.EU.net!netmbx.de!CNB.CompuNet.DE!zrz.TU-Berlin.DE!cs.tu-berlin.de!fauern!news.th-darmstadt.de!News.Uni-Marburg.DE!news.belwue.de!delos.stgt.sub.org!guru.stgt.sub.org!nils
From: nils@guru.stgt.sub.org (Cornelis van der Laan)
Subject: LISTEN_FOR_INPUT bug in port/lang/gcl
Followup-To: comp.os.386bsd.bugs
Reply-To: nils@ims.uni-stuttgart.de
Sender: news@guru.stgt.sub.org (Cornelis van der Laan)
Nntp-Posting-Host: localhost.ims.uni-stuttgart.de
Organization: Mehr Anarchie !
Message-ID: <NILS.95Feb20010940@guru.stgt.sub.org>
Date: Mon, 20 Feb 1995 00:09:40 GMT
Lines: 28

Thanks to whoever tried to put gcl-1.1 in ports/lang/gcl, but there is
a serious bug in the file files/FreeBSD.h (amongst several other
bugs which should be cured in the distribution of gcl itself).

We there read:

#undef LISTEN_FOR_INPUT
#define LISTEN_FOR_INPUT(fp) \
  ((fp)->_r <=0 && (c=0, ioctl((fp)->_file, FIONREAD, &c), c<=0))

This must be

#undef LISTEN_FOR_INPUT 
#define LISTEN_FOR_INPUT(fp) \
   if ((fp)->_r <=0 && (c=0, ioctl((fp)->_file, FIONREAD, &c), c<=0)) \
     return 0

since the code in c/file.d relies on returning a value; the default is
to always return true, which leads to all functions calling CLEAR-INPUT 
to just read another char whenever clear_input() returns true, which 
just perverts the meaning of clear_input().

Nils
--
----------------------------------------------------------------
Cornelis van der Laan -- nils@ims.uni-stuttgart.de
                      -- nils@guru.stgt.sub.org
# echo Knusper Knusper Knaeuschen > /etc/nologin