--- chgrp.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/chgrp.c b/chgrp.c index 7ee3553..21e7e22 100644 --- a/chgrp.c +++ b/chgrp.c _AT_@ -67,13 +67,16 @@ main(int argc, char *argv[]) usage(); errno = 0; - if (!(gr = getgrnam(argv[0]))) { + if ((gr = getgrnam(*argv))) { + gid = gr->gr_gid; + } else { if (errno) - eprintf("getgrnam %s:", argv[0]); - else - eprintf("getgrnam %s: no such group\n", argv[0]); + eprintf("getgrnam %s:", *argv); + gid = estrtonum(*argv, 0, UINT_MAX); } - gid = gr->gr_gid; + + if (gid == -1) + usage(); for (argc--, argv++; *argv; argc--, argv++) recurse(*argv, NULL, &r); -- 2.21.0Received on Thu Jul 04 2019 - 23:49:29 CEST
This archive was generated by hypermail 2.3.0 : Fri Jul 05 2019 - 00:00:40 CEST