[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: coreutils-8.14.116-1e18d on NetBSD 5.1 - split bug

From: Bruno Haible
Subject: Re: coreutils-8.14.116-1e18d on NetBSD 5.1 - split bug
Date: Thu, 05 Jan 2012 13:27:22 +0100
User-agent: KMail/4.7.4 (Linux/3.1.0-1.2-desktop; KDE/4.7.4; x86_64; ; )

Pádraig Brady wrote:
> I wonder should full_read() be adjusting the errno?
> I.E. maybe the behavior of read() and full_read() should
> be different, as the latter can do a successful partial read(),
> and then have a failure. So it should be possible to assume
> n_read >-1 and a valid errno?

Of course read() and full_read() have different return conventions, for
precisely the reason that you cite. But that's not a reason to set errno
always. POSIX functions set errno only in case of specific conditions
that you can check after the function returned. full_read() is designed
in the same spirit. If gnulib defined functions were to set errno always,
that would be an inconsistency between POSIX and gnulib.

The return convention of full_read() is perfectly well documented:

  /* Read COUNT bytes at BUF to descriptor FD, retrying if interrupted
     or if partial reads occur.  Return the number of bytes successfully
     read, setting errno if that is less than COUNT.  errno = 0 means EOF.  */
  extern size_t full_read (int fd, void *buf, size_t count);

Nothing to do there.


reply via email to

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