Ludovic Courtès, le lun. 21 avril 2025 00:59:00 +0200, a ecrit:
> Samuel Thibault <samuel.thiba...@gnu.org> writes:
> 
> > Ludovic Courtès, le dim. 20 avril 2025 17:40:02 +0200, a ecrit:
> >> What happens here is that reading from /dev/klog (opened with
> >> O_NONBLOCK) returns ED_WOULD_BLOCK.  However Guile and its concurrency
> >> framework (Fibers) don’t know about this error, hence the (non-fatal)
> >> backtrace, but they do know about EAGAIN and EWOULDBLOCK.
> >
> >> diff --git a/trans/streamio.c b/trans/streamio.c
> >> index e42ff908..cdc0af40 100644
> >> --- a/trans/streamio.c
> >> +++ b/trans/streamio.c
> >> @@ -1011,7 +1011,13 @@ dev_read (size_t amount, void **buf, size_t *len, 
> >> int nowait)
> >>      {
> >>        err = start_input (nowait);
> >>        if (err)
> >> -  return err;
> >> +  {
> >> +    if (err == ED_WOULD_BLOCK)
> >
> > Is that not already tested by start_input?
> 
> Oh right, it looks like it.
> 
> Still, ED_WOULD_BLOCK somehow reaches the client on a read(2) call:

dev_read starts with if (err) return err;. Various functions do not
define their own err variable. I don't know the original reason for
this, but this looks fishy to me, and local variables should probably
always be used, patch welcome.

Samuel

Reply via email to