[hackers] [sbase] chgrp: Only check errno if getgrnam() fails || sin
commit 83e94e922e688c4b090d96214651e687eb449654
Author: sin <sin_AT_2f30.org>
Date: Sun Dec 21 12:12:38 2014 +0000
chgrp: Only check errno if getgrnam() fails
diff --git a/chgrp.c b/chgrp.c
index 78ee68b..52ad1f0 100644
--- a/chgrp.c
+++ b/chgrp.c
_AT_@ -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) {
Received on Sun Dec 21 2014 - 13:14:47 CET
This archive was generated by hypermail 2.3.0
: Sun Dec 21 2014 - 13:24:09 CET