[PATCH] fix RLIM_NOFILE handling
commit4e1e018ecc6f7bfd10fc75b3ff9715cc8164e0a2
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 26 Jul 2008 20:01:20 +0000 (26 16:01 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 27 Jul 2008 00:53:45 +0000 (26 20:53 -0400)
tree75404b1269b079a327551f76a9b3f941f5b11a77
parent6c5d0512a091480c9f981162227fdb1c9d70e555
[PATCH] fix RLIM_NOFILE handling

* dup2() should return -EBADF on exceeded sysctl_nr_open
* dup() should *not* return -EINVAL even if you have rlimit set to 0;
  it should get -EMFILE instead.

Check for orig_start exceeding rlimit taken to sys_fcntl().
Failing expand_files() in dup{2,3}() now gets -EMFILE remapped to -EBADF.
Consequently, remaining checks for rlimit are taken to expand_files().

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/fcntl.c
fs/file.c
fs/open.c