Re: io_write()/fwrite() and EINTR on Solaris
From:
Jos Backus <jos@...>
Date:
2002-11-07 18:16:50 UTC
List:
ruby-core #569
On Thu, Nov 07, 2002 at 03:49:51PM +0900, nobu.nokada@softhome.net wrote:
> > Do you think that perhaps using the approach used on __human68k__ is better,
> > i.e. use the patch below patch instead? This incurs some overhead but for my
> > application that would be no problem. I still worry about dropping single
> > characters this way though.
>
> I haven't considered about that way. But don't guess this code
> is tested enough since September. In fact, in the case of EOF
> is returned by fputc() but false by ferror(), count of written
> bytes would be wrong. Did you worry about this?
No, but you are right, post-incrementing p unconditionally is wrong here (if I
read this code correctly). Your patch looks good.
> # now I'm afraid of fwrite() in marshal.c.
Hm, the return value of the fwrite() call in w_byten() is not checked at all,
that seems to be a potential troublespot to me. Perhaps move the fwrite()
wrapper into its own function (rb_safe_write()?) and call it in both places
instead?
Thank you, Nobu.
--
Jos Backus _/ _/_/_/ Sunnyvale, CA
_/ _/ _/
_/ _/_/_/
_/ _/ _/ _/
jos at catnook.com _/_/ _/_/_/ require 'std/disclaimer'