Trojan Horses
Steve Nuchia
steve at nuchat.UUCP
Fri Oct 19 00:36:34 AEST 1990
In article <BZS.90Oct17215707 at world.std.com> bzs at 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
More information about the Comp.unix.internals
mailing list