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; errno = 0;
gr = getgrnam(argv[0]); gr = getgrnam(argv[0]);
if (!gr) {
if (errno) if (errno)
eprintf("getgrnam %s:"); eprintf("getgrnam %s:", argv[0]);
else if (!gr) else
eprintf("getgrnam %s: no such group\n", argv[0]); eprintf("getgrnam %s: no such group\n", argv[0]);
}
gid = gr->gr_gid; gid = gr->gr_gid;
while (*++argv) { while (*++argv) {