I use "libarchive" for my xcode project:
static const char *
lookup_gname_helper(struct name_cache *cache, id_t id)
{
struct group *result;
(void)cache; /* UNUSED */
result = getgrgid((gid_t)id);
if (result == NULL)
return (NULL);
return strdup(result->gr_name);
}
And I'm getting bellow errors:
Conflicting types for 'getgrgid'
Implicit declaration of function 'getgrgid' is invalid in C99
Missing '#include '; declaration of 'getgrgid' must be imported from module 'Darwin.POSIX.grp' before it is required
Missing '#include '; definition of 'group' must be imported from module 'Darwin.POSIX.grp' before it is required
How can I fix this errors?
Source: https://github.com/LuaDist/libarchive/blob/master/libarchive/archive_read_disk_set_standard_lookup.c