On Thu 21 Feb 2013 17:29, Paolo Bonzini <bonz...@gnu.org> 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/