[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: full_read depends on incoming errno
From: |
Paul Eggert |
Subject: |
Re: full_read depends on incoming errno |
Date: |
Tue, 19 Feb 2013 13:25:37 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 |
On 02/19/13 13:15, Eli Zaretskii wrote:
> if (full_read (fd, cookie, sizeof cookie) != sizeof cookie
> || full_read (fd, SCM_BYTEVECTOR_CONTENTS (bv),
> SCM_BYTEVECTOR_LENGTH (bv)) != SCM_BYTEVECTOR_LENGTH (bv))
> {
> int errno_save = errno;
> (void) close (fd);
> errno = errno_save;
> SCM_SYSERROR;
> }
>
...
> If the file is too short for these two reads, then errno will have
> some random value (because full_read "succeeded" as far as that
> function is concerned), and the error message in SCM_SYSERROR will
> display something utterly unrelated
Yes, full_read should return a short value and set errno to 0,
so errno_save should be zero. If SCM_SYSERROR displays
a seemingly-unrelated diagnostic like "Error 0", that would
explain the problem.
> I think it's a Guile
> problem, since from gnulib POV, nothing went wrong in that call.
Yes, that sounds right.
- full_read depends on incoming errno, Andy Wingo, 2013/02/19
- Re: full_read depends on incoming errno, Paul Eggert, 2013/02/19
- Re: full_read depends on incoming errno, Eli Zaretskii, 2013/02/19
- Re: full_read depends on incoming errno,
Paul Eggert <=
- Re: full_read depends on incoming errno, Andy Wingo, 2013/02/19
- Re: full_read depends on incoming errno, Eli Zaretskii, 2013/02/20
- Re: full_read depends on incoming errno, Andy Wingo, 2013/02/20
- Re: full_read depends on incoming errno, Eli Zaretskii, 2013/02/20
- Re: full_read depends on incoming errno, Paolo Bonzini, 2013/02/21
- Re: full_read depends on incoming errno, Andy Wingo, 2013/02/21
- Re: full_read depends on incoming errno, Paolo Bonzini, 2013/02/21
- Re: full_read depends on incoming errno, Paul Eggert, 2013/02/21
- Re: full_read depends on incoming errno, Eli Zaretskii, 2013/02/21
- Re: full_read depends on incoming errno, Paul Eggert, 2013/02/21