[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: full_read depends on incoming errno
From: |
Eli Zaretskii |
Subject: |
Re: full_read depends on incoming errno |
Date: |
Thu, 21 Feb 2013 19:36:02 +0200 |
> From: Andy Wingo <address@hidden>
> Cc: Eli Zaretskii <address@hidden>, address@hidden, address@hidden
> Date: Thu, 21 Feb 2013 17:47:43 +0100
>
> 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?
AFAIK, you cannot rely on tests that compare errno with zero, unless
you reset it to zero before the operation that might set it.
> Otherwise, full_read sets errno to 0 if it returns a length less than
> the length we asked for
Where does it do that? I don't think I see this. Maybe I'm blind.
- Re: full_read depends on incoming errno, (continued)
- 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, 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 <=
- Re: full_read depends on incoming errno, Paul Eggert, 2013/02/21
- Re: full_read depends on incoming errno, Eli Zaretskii, 2013/02/21