aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2016-05-30 13:43:17 -0500
committerRob Landley <rob@landley.net>2016-05-30 13:43:17 -0500
commit6ba719100115ec788bcbc4276a1b4c31e937e855 (patch)
treeaa2a50ed24d766c800351b4972a9476074d135a7 /toys
parentbc8139a3a011568727219d3f1375061612e901ed (diff)
downloadtoybox-6ba719100115ec788bcbc4276a1b4c31e937e855.tar.gz
Add output path to cp error message filenames.
Diffstat (limited to 'toys')
-rw-r--r--toys/posix/cp.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/toys/posix/cp.c b/toys/posix/cp.c
index ea1ef6f4..d21af2ff 100644
--- a/toys/posix/cp.c
+++ b/toys/posix/cp.c
@@ -345,7 +345,19 @@ int cp_node(struct dirtree *try)
err = "%s";
}
- if (err) perror_msg(err, catch);
+ if (err) {
+ char *f = 0;
+
+ if (catch == try->name) {
+ f = dirtree_path(try, 0);
+ while (try->parent) try = try->parent;
+ catch = xmprintf("%s%s", TT.destname, f+strlen(try->name));
+ free(f);
+ f = catch;
+ }
+ perror_msg(err, catch);
+ free(f);
+ }
return 0;
}