[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: full_read depends on incoming errno
From: |
Andy Wingo |
Subject: |
Re: full_read depends on incoming errno |
Date: |
Tue, 19 Feb 2013 22:50:18 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) |
Hi,
On Tue 19 Feb 2013 22:25, Paul Eggert <address@hidden> writes:
> 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.
You are both right, yes. Thanks for the help and sorry for the
confusion.
Cheers,
Andy
--
http://wingolog.org/
- 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, 2013/02/19
- Re: full_read depends on incoming errno,
Andy Wingo <=
- 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
- Re: full_read depends on incoming errno, Eli Zaretskii, 2013/02/21