Hi there,

I try to create a ACL default entry for a directory. For now I activated acl's for the file system and if I create default entries with the command setfacl it works but not with my code I attached. The user and directory I want to set already exists. I create it with C++.

does anybody know what's wrong with it?
acl_t acl_default;
acl_tag_t tag;
acl_entry_t entry;
acl_permset_t permset;
id_t id;

acl_default = acl_get_file("/var/www/test/", ACL_TYPE_DEFAULT);

acl_create_entry(&acl_default, &entry);

tag = ACL_USER;

acl_set_tag_type(entry, tag);

id = 1002;

acl_set_qualifier(entry, static_cast<void*>(&id));

acl_get_permset(entry, &permset);


acl_add_perm(permset, ACL_READ);
acl_add_perm(permset, ACL_WRITE);
acl_add_perm(permset, ACL_EXECUTE);

acl_set_permset(entry, permset);


acl_set_file("/var/www/test/", ACL_TYPE_DEFAULT, acl_default);