chgrp: Only check errno if getgrnam() fails

This commit is contained in:
sin 2014-12-21 12:12:38 +00:00
parent 09dad0083b
commit 83e94e922e

View File

@ -50,10 +50,12 @@ main(int argc, char *argv[])
errno = 0;
gr = getgrnam(argv[0]);
if (!gr) {
if (errno)
eprintf("getgrnam %s:");
else if (!gr)
eprintf("getgrnam %s:", argv[0]);
else
eprintf("getgrnam %s: no such group\n", argv[0]);
}
gid = gr->gr_gid;
while (*++argv) {