chgrp: Only check errno if getgrnam() fails
This commit is contained in:
parent
09dad0083b
commit
83e94e922e
10
chgrp.c
10
chgrp.c
@ -50,10 +50,12 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
gr = getgrnam(argv[0]);
|
gr = getgrnam(argv[0]);
|
||||||
if (errno)
|
if (!gr) {
|
||||||
eprintf("getgrnam %s:");
|
if (errno)
|
||||||
else if (!gr)
|
eprintf("getgrnam %s:", argv[0]);
|
||||||
eprintf("getgrnam %s: no such group\n", argv[0]);
|
else
|
||||||
|
eprintf("getgrnam %s: no such group\n", argv[0]);
|
||||||
|
}
|
||||||
gid = gr->gr_gid;
|
gid = gr->gr_gid;
|
||||||
|
|
||||||
while (*++argv) {
|
while (*++argv) {
|
||||||
|
Loading…
Reference in New Issue
Block a user