From 67c57c75e094486e78b6d5c226426e1d41034d69 Mon Sep 17 00:00:00 2001 From: pooka Date: Sun, 12 Aug 2007 19:42:09 +0000 Subject: [PATCH] CREATE is a write operation in my book, so check for that also when checking for a readonly lookup. This shouldn't make a difference now, though, as the only RDONLY lookup is done by getcwd(), and that a) doesn't create files b) calls LOOKUP directly anyway. Also, fix comment I managed to miss in the previous commit (I didn't expect the same comment to be there twice). --- sys/kern/vfs_lookup.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 43ffc37b0f46..8485caac4e7d 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.94 2007/08/12 19:31:12 pooka Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.95 2007/08/12 19:42:09 pooka Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.94 2007/08/12 19:31:12 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.95 2007/08/12 19:42:09 pooka Exp $"); #include "opt_ktrace.h" #include "opt_systrace.h" @@ -890,12 +890,8 @@ terminal: * Disallow directory write attempts on read-only lookups. */ if (rdonly && - (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)) { - - /* - * Disallow directory write attempts on read-only - * file systems. - */ + (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME || + cnp->cn_nameiop == CREATE)) { error = EROFS; if (dp != ndp->ni_dvp) { vput(dp);