]> git.neil.brown.name Git - history.git/commit
[PATCH] Write with buffer>2GB returns broken errno (2)
authorRusty Russell <rusty@rustcorp.com.au>
Sun, 9 Feb 2003 11:01:17 +0000 (03:01 -0800)
committerLinus Torvalds <torvalds@home.transmeta.com>
Sun, 9 Feb 2003 11:01:17 +0000 (03:01 -0800)
commitf1a15652a2034b0b6da86209055c6828dd342716
tree7c17164a13154b98eeffa2d6f118ce6c9e3a75d6
parente88bb0c413ae98369ce7fc51963afb6e16cb5a3c
[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')
mm/filemap.c