[HEADSUP] Change to __sFile structure (was Re: [PATCH] Do not break buffers in fvwrite for unbuffered files)

Federico Terraneo fede.tft@hotmail.it
Thu Oct 31 09:57:00 GMT 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/23/2013 12:05 PM, Corinna Vinschen wrote:
> On Oct 21 13:35, Corinna wrote:
>> Here's my Proposal:
>> 
>> We introduce a new define called _READ_WRITE_BUFSIZE_TYPE.  It is
>> used as the type of the `count' parameter for the _read and
>> _write methods in struct __sFILE.  It's set to int by default for
>> backward compatibility. Interested targets can set it to the more
>> correct size_t in include/sys/config.h.

I've noticed another detail in fvwrite.h: while in struct __siov the
buffer length is (correctly) a size_t, the field uio_resid in struct
__suio, which is meant to be the sum of the size of all buffers is
still an int. This breaks fwrite() of > 2GByte buffers.

Attached is a patch that simply makes uio_resid a size_t. Since
fvwrite.h is a private header, I don't think there's any binary
compatibility issue.


2013-10-31  Terraneo Federico  <fede.tft@hotmail.it>


	* libc/stdio/fvwrite.h: change type of uio_resid from int
	 to size_t to fix fwrite() of > 2GByte buffers
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJScimNAAoJECkLFtN5Xr9fbVwH/A8KfS8WTJvsJwFT4tDm6P8x
OeGkQtHcbYQDLheg4HHkTvrsNt5IsZAFDtBnDWjfQ9+r/SMYx64CxZWFozRiGgMA
xYomzYzx7pSAH9MfjvpWXKSK/x95ICLikfhVmuZWFHG9/ysCvBty2k7L2HJiBihv
RFrE5EDqcSeRpVGMFoqqJmBgAdqQ3wAQ0TpQTA4R7YlpJF29B3ltPdJVstNwQYVE
WcQj4ijwfJ9EWpA9662OIKGVQWwucbmTuklNkTQWSWoqoKe/27r5VRBSBsVb+SBS
gfBWm/buzaXpLfZCSkz+8OpTubfhq/wkfUz1m9tfjbEgBrtyslhVRtjTizY362w=
=I+Qc
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: uio_resid.patch
Type: text/x-patch
Size: 334 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20131031/ff9651f0/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: uio_resid.patch.sig
Type: application/octet-stream
Size: 287 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20131031/ff9651f0/attachment.obj>


More information about the Newlib mailing list