[Top][All Lists]

[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: Wed, 20 Feb 2013 20:58:13 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

On Wed 20 Feb 2013 20:02, Eli Zaretskii <address@hidden> writes:

> Btw, it might be a good idea to provide some application-level
> diagnostics in this specific case, since "No error", which corresponds
> to errno = 0, is not very useful.

I pushed this:

    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_misc_error (FUNC_NAME, "file truncated while reading", SCM_EOL);

Should be OK, no?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]