fcntl write lock on readonly file error fix
[openafs.git] / src / afs / VNOPS / afs_vnop_flock.c
index d8b159d..8010e73 100644 (file)
@@ -434,6 +434,8 @@ HandleFlock(register struct vcache *avc, int acom, struct vrequest *areq,
                                 (tc, code, &avc->f.fid, areq,
                                  AFS_STATS_FS_RPCIDX_SETLOCK, SHARED_LOCK,
                                  NULL));
+                       if ((LockType == LockWrite) && (code == VREADONLY))
+                           code = EBADF; /* per POSIX; VREADONLY == EROFS */
                    } else
                        /* XXX - Should probably try and log this when we're
                         * XXX - running with logging enabled. But it's horrid