diff options
author | Rob Landley <rob@landley.net> | 2019-03-04 08:05:13 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2019-03-04 08:05:13 -0600 |
commit | 51aab4cd76991df3e2961dbdc2151631f17afce1 (patch) | |
tree | d8f43149e3fdcedb423e32219a0fa41d283caaf0 | |
parent | 6d1eb1ce40801323b65401a70ae5f9782939eeb4 (diff) | |
download | toybox-51aab4cd76991df3e2961dbdc2151631f17afce1.tar.gz |
Don't print (null) in error messages.
-rw-r--r-- | toys/posix/chgrp.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/toys/posix/chgrp.c b/toys/posix/chgrp.c index 85a4102c..8c2e95b4 100644 --- a/toys/posix/chgrp.c +++ b/toys/posix/chgrp.c @@ -58,10 +58,9 @@ static int do_chgrp(struct dirtree *node) if (ret || (flags & FLAG_v)) { char *path = dirtree_path(node, 0); if (flags & FLAG_v) - xprintf("%s %s%s%s %s\n", toys.which->name, - TT.owner_name ? TT.owner_name : "", - toys.which->name[2]=='o' && TT.group_name ? ":" : "", - TT.group_name ? TT.group_name : "", path); + xprintf("%s %s%s%s %s\n", toys.which->name, TT.owner_name, + (toys.which->name[2]=='o' && *TT.group_name) ? ":" : "", + TT.group_name, path); if (ret == -1 && !(toys.optflags & FLAG_f)) perror_msg("'%s' to '%s:%s'", path, TT.owner_name, TT.group_name); free(path); @@ -77,6 +76,7 @@ void chgrp_main(void) char **s, *own; TT.owner = TT.group = -1; + TT.owner_name = TT.group_name = ""; // Distinguish chown from chgrp if (ischown) { |