Fix BZ # 2074
Andreas Jaeger
aj@suse.com
Wed Apr 11 19:13:00 GMT 2012
On 04/11/2012 06:44 PM, Roland McGrath wrote:
> That does seem to make the documentation consistent with the code.
> The comment on __io_write_fn in libio/libio.h needs to be changed too.
> Since that's the interface, it's unfortunate that we use ssize_t in the
> type signatures. They very much look like they are intended to be exactly
> the interfaces of read and write (with the int fd replaced with the void
> *cookie). In fact, I'm quite sure that was my original intention in the
> pre-libio stdio implementation. If there's any way we can compatibly
> recover the situation so the functions have the more-obvious interfaces,
> that seems like the best thing to me. But even in the interface described
> by the __io_write_fn comment is not quite analogous to write's interface,
> since write can return short counts.
Roland, what do you propose doing? Changing the code is out of my scope
for now.
I can add the patch together with the following change for libio.h - or
we can leave the bug open and Ican add your ocmment above to it...
Andreas
* libio/libio.h (__io_write_fn): Update comment.
diff --git a/libio/libio.h b/libio/libio.h
index 702a666..3b91602 100644
--- a/libio/libio.h
+++ b/libio/libio.h
@@ -346,7 +346,7 @@ extern _IO_FILE *_IO_stderr attribute_hidden;
typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t
__nbytes);
/* Write N bytes pointed to by BUF to COOKIE. Write all N bytes
- unless there is an error. Return number of bytes written, or -1 if
+ unless there is an error. Return number of bytes written, or 0 if
there is an error without writing anything. If the file has been
opened for append (__mode.__append set), then set the file pointer
to the end of the file and then do the write; if not, just write at
--
Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126
More information about the Libc-alpha
mailing list