[KinoSearch] KinoSearch Death
Aaron Crane
perl at aaroncrane.co.uk
Fri Oct 20 04:55:08 PDT 2006
Marvin Humphrey writes:
> When PerlIO_read fails, it's supposed to set errno to a positive
> number indicating the type of error that occurred -- just like the
> stdio function fread(). Here's a snippet from its documentation in
> perlapio:
>
> Returns a byte count if successful (which may be zero or positive),
> returns negative value and sets errno on error.
>
> So, it looks like we've tickled a bug in PerlIO_read. It thinks it
> succeeded by giving us 0 bytes, even though we asked for 1024.
I strongly suspect that's not a bug in PerlIO_read. If PerlIO_read()
really is like stdio fread() (or POSIX read(), for that matter), it's
designed to treat a short read as success. That is, the read returns as
many bytes as you asked for, or as many as were available, whichever is
less. In particular, if you attempt to read from a file when there are
no more bytes of the file left to read, that gives you a successful read
of 0 bytes -- an EOF condition.
--
Aaron Crane
_______________________________________________
KinoSearch mailing list
KinoSearch at rectangular.com
http://www.rectangular.com/mailman/listinfo/kinosearch
More information about the kinosearch
mailing list