diff options
Diffstat (limited to 'toys')
-rw-r--r-- | toys/posix/chgrp.c | 4 |
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)); |