[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: |
Thu, 21 Feb 2013 17:47:43 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) |
On Thu 21 Feb 2013 17:29, Paolo Bonzini <address@hidden> writes:
> Il 20/02/2013 20:58, Andy Wingo ha scritto:
>>
>> 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;
>> if (errno)
>> SCM_SYSERROR;
>> scm_misc_error (FUNC_NAME, "file truncated while reading", SCM_EOL);
>> }
>
> Doesn't it need to set errno to zero before calling full_read?
Not sure! If full_read requires that errno be 0 going in, then yes, we
should. Is this a requirement?
Otherwise, full_read sets errno to 0 if it returns a length less than
the length we asked for, and we're OK in that case AFAICS.
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, 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 <=
- 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