diff toys/posix/chgrp.c @ 735:3aaba60133c8

Have dirtree_add_node() set parent so error message can provide full path.
author Rob Landley <rob@landley.net>
date Thu, 06 Dec 2012 15:13:30 -0600
parents 786841fdb1e0
children 90e98cdb1b7c
line wrap: on
line diff
--- a/toys/posix/chgrp.c	Mon Dec 03 16:16:06 2012 -0600
+++ b/toys/posix/chgrp.c	Thu Dec 06 15:13:30 2012 -0600
@@ -71,7 +71,7 @@
 
 void chgrp_main(void)
 {
-  int ischown = toys.which->name[2] == 'o';
+  int ischown = toys.which->name[2] == 'o', hl = toys.optflags&(FLAG_H|FLAG_L);
   char **s, *own;
 
   // Distinguish chown from chgrp
@@ -103,8 +103,7 @@
   }
 
   for (s=toys.optargs+1; *s; s++) {
-    struct dirtree *new = dirtree_add_node(AT_FDCWD, *s,
-      toys.optflags&(FLAG_H|FLAG_L));
+    struct dirtree *new = dirtree_add_node(0, *s, hl);
     if (new) handle_callback(new, do_chgrp);
     else toys.exitval = 1;
   }