]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
fs: sysfs: return EGBIG on write if offset is larger than file size
authorVladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Wed, 24 Sep 2014 15:21:04 +0000 (18:21 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Nov 2014 18:52:20 +0000 (10:52 -0800)
commit0936896056365349afa867c16e9f9100a6707cbf
tree0fa7c920611d832417e38ab661a5795a2f6d8de1
parent41fb96a4b619afd2272acb6e981a7581efa8e118
fs: sysfs: return EGBIG on write if offset is larger than file size

According to the user expectations common utilities like dd or sh
redirection operator > should work correctly over binary files from
sysfs. At the moment doing excessive write can not be completed:

  write(1, "\0\0\0\0\0\0\0\0", 8)         = 4
  write(1, "\0\0\0\0", 4)                 = 0
  write(1, "\0\0\0\0", 4)                 = 0
  write(1, "\0\0\0\0", 4)                 = 0
  ...

Fix the problem by returning EFBIG described in man 2 write.

Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/sysfs/file.c