sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit 83e94e922e688c4b090d96214651e687eb449654
parent 09dad0083b598d6bc4ea7b3a6775849833099e32
Author: sin <sin@2f30.org>
Date:   Sun, 21 Dec 2014 12:12:38 +0000

chgrp: Only check errno if getgrnam() fails

Diffstat:
Mchgrp.c | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

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