-/* $OpenBSD: vfs_lookup.c,v 1.71 2018/07/13 09:25:23 beck Exp $ */
+/* $OpenBSD: vfs_lookup.c,v 1.72 2018/07/30 00:16:59 beck Exp $ */
/* $NetBSD: vfs_lookup.c,v 1.17 1996/02/09 19:00:59 christos Exp $ */
/*
}
/*
* If creating and at end of pathname, then can consider
- * allowing file to be created.
+ * allowing file to be created. Check for a read only
+ * filesystem and disallow this unless we are unveil'ing
*/
- if (rdonly || (ndp->ni_dvp->v_mount->mnt_flag & MNT_RDONLY)) {
- error = EROFS;
- goto bad;
+ if (ndp->ni_pledge != PLEDGE_UNVEIL && (rdonly ||
+ (ndp->ni_dvp->v_mount->mnt_flag & MNT_RDONLY))) {
+ error = EROFS;
+ goto bad;
}
/*
* We return with ni_vp NULL to indicate that the entry