1

getgrnam() causing error for no apparent reason?

view story
linux-howto

http://stackoverflow.com – I am getting an error that makes no sense. I have the following code - #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <grp.h> gid_t groupIdFromName(const char *name) { struct group *grp; gid_t g; char *endptr; if (name == NULL || *name == '\0') return -1; g = strtol(name, &endptr, 10); if (*endptr == '\0') return g; grp = getgrnam(name); if (grp == NULL) return -1; return grp->gr_gid; } int main(int argc, char** argv) { return (EXIT_SUCCESS); } I am using NetBeans in Li (HowTos)