2000-11-23 17:33:59

by Matt Kraai

[permalink] [raw]
Subject: [PATCH] Fix error code when read()ing directories in /proc

Howdy,

Calling read() on some directories in /proc returns EINVAL, rather
than EISDIR. The other filesystems return EISDIR and the manpage says
this is what should be returned in this situation. The appended patch
applies against 2.4.0-test11.

Matt

diff -urN linux-vanilla/fs/proc/generic.c linux/fs/proc/generic.c
--- linux-vanilla/fs/proc/generic.c Fri Nov 17 16:51:47 2000
+++ linux/fs/proc/generic.c Thu Nov 23 08:00:41 2000
@@ -336,6 +336,7 @@
* the /proc directory.
*/
static struct file_operations proc_dir_operations = {
+ read: generic_read_dir,
readdir: proc_readdir,
};

diff -urN linux-vanilla/fs/proc/root.c linux/fs/proc/root.c
--- linux-vanilla/fs/proc/root.c Fri Nov 17 16:51:47 2000
+++ linux/fs/proc/root.c Thu Nov 23 08:00:27 2000
@@ -82,6 +82,7 @@
* directory handling functions for that..
*/
static struct file_operations proc_root_operations = {
+ read: generic_read_dir,
readdir: proc_root_readdir,
};