[PATCH] Write with buffer>2GB returns broken errno (2)
[ Acked by AKPM --RR ]
From: Kazuto MIYOSHI <miyoshi@hpc.bs1.fc.nec.co.jp>
On 64-bit platforms, issuing write(2) with buffer larger than
2GB will return -1 and broken errno (such as
2147483640)
Requested data itself is written correctly.
That is because generic_file_write() and other relating functions
store 'ssize_t written' into 'int err'. Written byte is trimmed to
int and then sign-extended to a negative ssize_t value, which
wrongly indicates an error.
(On 64bit platform, current glibc defines SSIZE_MAX as 'LONG_MAX')