[Acl-Devel] why strcmp(name, "") ?

Andreas Gruenbacher agruen at suse.de
Thu Feb 16 10:03:44 CET 2006


On Thursday 16 February 2006 09:29, h.xu wrote:
> Hi!
>
> In linux-2.6.12.5/fs/ext3/acl.c, we have the following code:
>
> static int
> ext3_xattr_get_acl_access(struct inode *inode, const char *name,
>               void *buffer, size_t size)
> {
>     if (strcmp(name, "") != 0)
>         return -EINVAL;
>     return ext3_xattr_get_acl(inode, ACL_TYPE_ACCESS, buffer, size);
> }
>
> [...]
>
> My question is:
>
> Why strcmp `name' with ""?  Why must `name' be ""?  Who called these
> functions and are they sure that `name' parameter must be ""?

Because the VFS only does a prefix match, so all requests for attributes 
called system.posix_acl_access* end up here. We only want to make sure there 
is no garbage at the end.

Andreas

-- 
Andreas Gruenbacher <agruen at suse.de>
SUSE Labs, SUSE LINUX Products GmbH / Novell Inc.


More information about the acl-devel mailing list