aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/fs/cd9660/cd9660_lookup.c4
-rw-r--r--sys/fs/cd9660/cd9660_vnops.c18
-rw-r--r--sys/isofs/cd9660/cd9660_lookup.c4
-rw-r--r--sys/isofs/cd9660/cd9660_vnops.c18
4 files changed, 38 insertions, 6 deletions
diff --git a/sys/fs/cd9660/cd9660_lookup.c b/sys/fs/cd9660/cd9660_lookup.c
index 9c359d13403f..c22bfcdf1832 100644
--- a/sys/fs/cd9660/cd9660_lookup.c
+++ b/sys/fs/cd9660/cd9660_lookup.c
@@ -38,7 +38,7 @@
* from: @(#)ufs_lookup.c 7.33 (Berkeley) 5/19/91
*
* @(#)cd9660_lookup.c 8.2 (Berkeley) 1/23/94
- * $Id: cd9660_lookup.c,v 1.7 1995/05/30 08:04:57 rgrimes Exp $
+ * $Id: cd9660_lookup.c,v 1.8 1995/10/22 09:32:15 davidg Exp $
*/
#include <sys/param.h>
@@ -376,7 +376,7 @@ notfound:
if (cnp->cn_flags & MAKEENTRY)
cache_enter(vdp, *vpp, cnp);
if (nameiop == CREATE || nameiop == RENAME)
- return (EJUSTRETURN);
+ return (EROFS);
return (ENOENT);
found:
diff --git a/sys/fs/cd9660/cd9660_vnops.c b/sys/fs/cd9660/cd9660_vnops.c
index 074de85d434c..0296eca22d45 100644
--- a/sys/fs/cd9660/cd9660_vnops.c
+++ b/sys/fs/cd9660/cd9660_vnops.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_vnops.c 8.3 (Berkeley) 1/23/94
- * $Id: cd9660_vnops.c,v 1.18 1995/10/31 12:13:47 phk Exp $
+ * $Id: cd9660_vnops.c,v 1.19 1995/11/09 08:13:37 bde Exp $
*/
#include <sys/param.h>
@@ -183,6 +183,22 @@ cd9660_access(ap)
struct proc *a_p;
} */ *ap;
{
+ /*
+ * Disallow write attempts on read-only file systems;
+ * unless the file is a socket, fifo, or a block or
+ * character device resident on the file system.
+ */
+ if (ap->a_mode & VWRITE) {
+ switch (ap->a_vp->v_type) {
+ case VDIR:
+ case VLNK:
+ case VREG:
+ if (ap->a_vp->v_mount->mnt_flag & MNT_RDONLY)
+ return (EROFS);
+ break;
+ }
+ }
+
return (0);
}
diff --git a/sys/isofs/cd9660/cd9660_lookup.c b/sys/isofs/cd9660/cd9660_lookup.c
index 9c359d13403f..c22bfcdf1832 100644
--- a/sys/isofs/cd9660/cd9660_lookup.c
+++ b/sys/isofs/cd9660/cd9660_lookup.c
@@ -38,7 +38,7 @@
* from: @(#)ufs_lookup.c 7.33 (Berkeley) 5/19/91
*
* @(#)cd9660_lookup.c 8.2 (Berkeley) 1/23/94
- * $Id: cd9660_lookup.c,v 1.7 1995/05/30 08:04:57 rgrimes Exp $
+ * $Id: cd9660_lookup.c,v 1.8 1995/10/22 09:32:15 davidg Exp $
*/
#include <sys/param.h>
@@ -376,7 +376,7 @@ notfound:
if (cnp->cn_flags & MAKEENTRY)
cache_enter(vdp, *vpp, cnp);
if (nameiop == CREATE || nameiop == RENAME)
- return (EJUSTRETURN);
+ return (EROFS);
return (ENOENT);
found:
diff --git a/sys/isofs/cd9660/cd9660_vnops.c b/sys/isofs/cd9660/cd9660_vnops.c
index 074de85d434c..0296eca22d45 100644
--- a/sys/isofs/cd9660/cd9660_vnops.c
+++ b/sys/isofs/cd9660/cd9660_vnops.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_vnops.c 8.3 (Berkeley) 1/23/94
- * $Id: cd9660_vnops.c,v 1.18 1995/10/31 12:13:47 phk Exp $
+ * $Id: cd9660_vnops.c,v 1.19 1995/11/09 08:13:37 bde Exp $
*/
#include <sys/param.h>
@@ -183,6 +183,22 @@ cd9660_access(ap)
struct proc *a_p;
} */ *ap;
{
+ /*
+ * Disallow write attempts on read-only file systems;
+ * unless the file is a socket, fifo, or a block or
+ * character device resident on the file system.
+ */
+ if (ap->a_mode & VWRITE) {
+ switch (ap->a_vp->v_type) {
+ case VDIR:
+ case VLNK:
+ case VREG:
+ if (ap->a_vp->v_mount->mnt_flag & MNT_RDONLY)
+ return (EROFS);
+ break;
+ }
+ }
+
return (0);
}