Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Sep 1996 05:56:33 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        cvs-all@freefall.freebsd.org, CVS-committers@freefall.freebsd.org, cvs-lib@freefall.freebsd.org, pst@freefall.freebsd.org
Subject:   Re: cvs commit:  src/lib/libc/stdio funopen.3
Message-ID:  <199609131956.FAA22959@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>  Modified:    lib/libc/stdio  funopen.3
>  Log:
>  fwopen() argument type mis-described
>  
>  Obtained from: NetBSD lib/2751 (der Mouse)


Hmmm, the fwopen() and fropen() function arg types are mis-designed
- they are incompatible write() and read, e.g,:

    ssize_t write      (int fd,       void const *buf, size_t nbytes);
    |||||||                           ||||             ||||||
    int     (*writefn) (void *cookie, char const *buf, int    nbytes);

This matters if size_t is larger than int and if write() can sucessfully
return a negative count.  It is easy to write a writefn that can
successfully returns a negative count and easy to return such a count
on a 16-bit system.  __sfvwrite() misinterprets negative counts as
errors although the man page says that only -1 is an error.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199609131956.FAA22959>