Allow block special files to be file locked

This commit is contained in:
Thomas Veerman 2011-08-22 11:46:58 +00:00
parent 63a49a4b90
commit 55d926cbaa

View file

@ -43,7 +43,8 @@ int req; /* either F_SETLK or F_SETLKW */
mo = f->filp_mode;
if (ltype != F_UNLCK && ltype != F_RDLCK && ltype != F_WRLCK) return(EINVAL);
if (req == F_GETLK && ltype == F_UNLCK) return(EINVAL);
if ( (f->filp_vno->v_mode & I_TYPE) != I_REGULAR) return(EINVAL);
if ( (f->filp_vno->v_mode & I_TYPE) != I_REGULAR &&
(f->filp_vno->v_mode & I_TYPE) != I_BLOCK_SPECIAL) return(EINVAL);
if (req != F_GETLK && ltype == F_RDLCK && (mo & R_BIT) == 0) return(EBADF);
if (req != F_GETLK && ltype == F_WRLCK && (mo & W_BIT) == 0) return(EBADF);