aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-01-14 03:43:49 -0600
committerElliott Hughes <enh@google.com>2015-01-14 03:43:49 -0600
commit50d320777a47132f07eb4e6707b7247f8db8861a (patch)
treef57f9e9e11835e35fbfea5274ef34722c63134c3 /toys
parent698a160868dba71766a8607b72a07eaa63d74da4 (diff)
downloadtoybox-50d320777a47132f07eb4e6707b7247f8db8861a.tar.gz
i found a few problems while manually smoke testing toybox chown versus toolbox (NetBSD) chown...
new test: and here's the patch to fix "owner:" ":group" and the ":" special case:
Diffstat (limited to 'toys')
-rw-r--r--toys/posix/chgrp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/toys/posix/chgrp.c b/toys/posix/chgrp.c
index dc7741bc..556b0f19 100644
--- a/toys/posix/chgrp.c
+++ b/toys/posix/chgrp.c
@@ -77,6 +77,8 @@ void chgrp_main(void)
int ischown = toys.which->name[2] == 'o', hl = toys.optflags&(FLAG_H|FLAG_L);
char **s, *own;
+ TT.owner = TT.group = -1;
+
// Distinguish chown from chgrp
if (ischown) {
char *grp;
@@ -97,7 +99,7 @@ void chgrp_main(void)
}
} else TT.group_name = *toys.optargs;
- if (TT.group_name) {
+ if (TT.group_name && *TT.group_name) {
struct group *g;
g = getgrnam(TT.group_name);
if (!g) g=getgrgid(atoi(TT.group_name));