Adding rmdir() syscall and improving permissions checking