Index: vm_mmap.c =================================================================== RCS file: /home/cvsup/freebsd/CVS/src/sys/vm/vm_mmap.c,v retrieving revision 1.53.2.3 retrieving revision 1.53.2.4 diff -u -r1.53.2.3 -r1.53.2.4 --- vm_mmap.c 1998/03/12 19:36:50 1.53.2.3 +++ vm_mmap.c 1998/05/24 19:47:02 1.53.2.4 @@ -57,6 +57,7 @@ #include #include #include +#include #include #include @@ -275,12 +276,26 @@ * we're at securelevel < 1, to allow the XIG X server * to continue to work. */ - if (((flags & MAP_SHARED) != 0 || - (vp->v_type == VCHR && disablexworkaround)) && - (fp->f_flag & FWRITE) == 0 && (prot & PROT_WRITE) != 0) - return (EACCES); - else + + if ((flags & MAP_SHARED) != 0 || + (vp->v_type == VCHR && disablexworkaround)) { + if ((fp->f_flag & FWRITE) != 0) { + struct vattr va; + + if ((error = + VOP_GETATTR(vp, &va, + p->p_ucred, p))) + return (error); + if ((va.va_flags & + (IMMUTABLE|APPEND)) == 0) + maxprot |= VM_PROT_WRITE; + else if (prot & PROT_WRITE) + return (EPERM); + } else if ((prot & PROT_WRITE) != 0) + return (EACCES); + } else maxprot |= VM_PROT_WRITE; + handle = (caddr_t) vp; } }