Index: vm_mmap.c =================================================================== RCS file: /home/cvsup/freebsd/CVS/src/sys/vm/vm_mmap.c,v retrieving revision 1.75 retrieving revision 1.77 diff -u -r1.75 -r1.77 --- vm_mmap.c 1998/03/12 19:36:18 1.75 +++ vm_mmap.c 1998/05/19 07:13:21 1.77 @@ -58,6 +58,7 @@ #include #include #include +#include #include #include @@ -295,12 +296,25 @@ * 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 = (void *)vp; } }