aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2019-03-04 08:05:13 -0600
committerRob Landley <rob@landley.net>2019-03-04 08:05:13 -0600
commit51aab4cd76991df3e2961dbdc2151631f17afce1 (patch)
treed8f43149e3fdcedb423e32219a0fa41d283caaf0 /toys/posix
parent6d1eb1ce40801323b65401a70ae5f9782939eeb4 (diff)
downloadtoybox-51aab4cd76991df3e2961dbdc2151631f17afce1.tar.gz
Don't print (null) in error messages.
Diffstat (limited to 'toys/posix')
-rw-r--r--toys/posix/chgrp.c8
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) {