* sysfs open should fail with -EACCES not -EPERM
@ 2002-12-03 20:47 Paul Larson
0 siblings, 0 replies; only message in thread
From: Paul Larson @ 2002-12-03 20:47 UTC (permalink / raw)
To: mochel; +Cc: lkml
[-- Attachment #1: Type: text/plain, Size: 1010 bytes --]
I noticed that opening a file for write on sysfs that doesn't support it
returns -EPERM. After checking the SuS, I believe the correct behavior
is to return -EACCES.
-Paul Larson
diff -Naur linux-2.5.50/fs/sysfs/inode.c linux-2.5.50-sysfsfix/fs/sysfs/inode.c
--- linux-2.5.50/fs/sysfs/inode.c Wed Nov 27 16:36:17 2002
+++ linux-2.5.50-sysfsfix/fs/sysfs/inode.c Tue Dec 3 14:07:19 2002
@@ -279,9 +279,7 @@
*/
if (file->f_mode & FMODE_WRITE) {
- if (!(inode->i_mode & S_IWUGO))
- goto Eperm;
- if (!ops->store)
+ if (!(inode->i_mode & S_IWUGO) || !ops->store)
goto Eaccess;
}
@@ -291,9 +289,7 @@
* must be a show method for it.
*/
if (file->f_mode & FMODE_READ) {
- if (!(inode->i_mode & S_IRUGO))
- goto Eperm;
- if (!ops->show)
+ if (!(inode->i_mode & S_IRUGO) || !ops->show)
goto Eaccess;
}
@@ -308,9 +304,6 @@
goto Done;
Eaccess:
error = -EACCES;
- goto Done;
- Eperm:
- error = -EPERM;
Done:
return error;
}
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 240 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-12-03 20:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-03 20:47 sysfs open should fail with -EACCES not -EPERM Paul Larson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox