Mercurial > hg > toybox
comparison 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 |
comparison
equal
deleted
inserted
replaced
734:7e0cea8fbc3e | 735:3aaba60133c8 |
---|---|
69 return 0; | 69 return 0; |
70 } | 70 } |
71 | 71 |
72 void chgrp_main(void) | 72 void chgrp_main(void) |
73 { | 73 { |
74 int ischown = toys.which->name[2] == 'o'; | 74 int ischown = toys.which->name[2] == 'o', hl = toys.optflags&(FLAG_H|FLAG_L); |
75 char **s, *own; | 75 char **s, *own; |
76 | 76 |
77 // Distinguish chown from chgrp | 77 // Distinguish chown from chgrp |
78 if (ischown) { | 78 if (ischown) { |
79 char *grp; | 79 char *grp; |
101 if (!g) error_exit("no group '%s'", TT.group_name); | 101 if (!g) error_exit("no group '%s'", TT.group_name); |
102 TT.group = g->gr_gid; | 102 TT.group = g->gr_gid; |
103 } | 103 } |
104 | 104 |
105 for (s=toys.optargs+1; *s; s++) { | 105 for (s=toys.optargs+1; *s; s++) { |
106 struct dirtree *new = dirtree_add_node(AT_FDCWD, *s, | 106 struct dirtree *new = dirtree_add_node(0, *s, hl); |
107 toys.optflags&(FLAG_H|FLAG_L)); | |
108 if (new) handle_callback(new, do_chgrp); | 107 if (new) handle_callback(new, do_chgrp); |
109 else toys.exitval = 1; | 108 else toys.exitval = 1; |
110 } | 109 } |
111 | 110 |
112 if (CFG_TOYBOX_FREE) free(own); | 111 if (CFG_TOYBOX_FREE) free(own); |