aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2012-12-06 15:13:30 -0600
committerRob Landley <rob@landley.net>2012-12-06 15:13:30 -0600
commit3162c27324bb6a26cfb9e47b266d2a3ee451f47b (patch)
tree0aa4d5cd7af9f9f3398ade523bddcfd2110fea57 /toys/posix
parent5434415c11af6ea91f61fe2e873cfc29afc5657f (diff)
downloadtoybox-3162c27324bb6a26cfb9e47b266d2a3ee451f47b.tar.gz
Have dirtree_add_node() set parent so error message can provide full path.
Diffstat (limited to 'toys/posix')
-rw-r--r--toys/posix/chgrp.c5
-rw-r--r--toys/posix/du.c2
-rw-r--r--toys/posix/ls.c2
3 files changed, 4 insertions, 5 deletions
diff --git a/toys/posix/chgrp.c b/toys/posix/chgrp.c
index ed2ff9b2..802d8f8f 100644
--- a/toys/posix/chgrp.c
+++ b/toys/posix/chgrp.c
@@ -71,7 +71,7 @@ static int do_chgrp(struct dirtree *node)
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 @@ void chgrp_main(void)
}
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;
}
diff --git a/toys/posix/du.c b/toys/posix/du.c
index 68cf286d..6c09aec6 100644
--- a/toys/posix/du.c
+++ b/toys/posix/du.c
@@ -203,7 +203,7 @@ void du_main(void)
while(*toys.optargs) {
TT.depth = 0;
char *path = make_pathproper(*toys.optargs);
- struct dirtree *root = dirtree_add_node(AT_FDCWD, path, symfollow); //create a node
+ struct dirtree *root = dirtree_add_node(0, path, symfollow);
if(root) {
TT.st_dev = root->st.st_dev;
handle_callback(root, do_du); //this will recurse thru the DIR children.
diff --git a/toys/posix/ls.c b/toys/posix/ls.c
index 6bb41521..cd881b05 100644
--- a/toys/posix/ls.c
+++ b/toys/posix/ls.c
@@ -436,7 +436,7 @@ void ls_main(void)
// Non-absolute paths are relative to current directory.
TT.files = dirtree_add_node(0, 0, 0);
for (s = *toys.optargs ? toys.optargs : noargs; *s; s++) {
- dt = dirtree_add_node(AT_FDCWD, *s,
+ dt = dirtree_add_node(0, *s,
(toys.optflags & (FLAG_L|FLAG_H|FLAG_l))^FLAG_l);
if (!dt) {