Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!julius.cs.uiuc.edu!zaphod.mps.ohio-state.edu!lavaca.uh.edu!menudo.uh.edu!nuchat!steve From: steve@nuchat.UUCP (Steve Nuchia) Newsgroups: comp.unix.internals Subject: Re: Trojan Horses Message-ID: <29435@nuchat.UUCP> Date: 18 Oct 90 14:36:34 GMT References: <1990Oct7.155203.13283@hq.demos.su> <18578@rpp386.cactus.org> <3173@unisoft.UUCP> Reply-To: steve@nuchat.UUCP (Steve Nuchia) Organization: Houston Public Access Lines: 22 In article bzs@world.std.com (Barry Shein) writes: >Trying to close a closed file descriptor will cause -1 to be returned >and errno set to EBADF. Close can also be interrupted (EINTR), I would You get EBADF if you pass it something that isn't an open file descriptor, whether it used to be one or not. If you have a 4.2 BSD or earlier "more" (maybe still, I dunno) ask it for help N times, where N is approximately equal to the maximum number of file descriptors your kernel allows. This demonstration "worked" (ie, broke) last time I tried it on a Sun. I'm told that the code is passing a FILE * to close(2), and not checking the return value. Naughty Naughty. On the other hand, you should never check for an error that you don't know what to do about. :-) -- Steve Nuchia South Coast Computing Services (713) 964-2462 "Could we find tools that would teach their own use, we should have discovered something truly beyond price." Socrates, in Plato's Republic