public void setPermission ( String src , FsPermission permission ) throws IOException { INode [ ] inodes = null ; writeLock ( ) ; try { if ( isInSafeMode ( ) ) { throw new SafeModeException ( "Cannot set permission for " + src , safeMode ) ; } inodes = dir . getExistingPathINodes ( src ) ; if ( isPermissionCheckingEnabled ( inodes ) ) { checkOwner ( src , inodes ) ; } dir . setPermission ( src , permission ) ; } finally { writeUnlock ( ) ; } getEditLog ( ) . logSync ( false ) ; if ( auditLog . isInfoEnabled ( ) ) { logAuditEvent ( getCurrentUGI ( ) , Server . getRemoteIp ( ) , "setPermission" , src , null , getLastINode ( inodes ) ) ; } }
Set permissions for an existing file .