Check for getgrnam() failure instead of crashing.