From 50d320777a47132f07eb4e6707b7247f8db8861a Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 14 Jan 2015 03:43:49 -0600 Subject: 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: --- toys/posix/chgrp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'toys/posix') 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)); -- cgit v1.2.3