aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/cp.c
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-08-30 06:35:30 -0500
committerRob Landley <rob@landley.net>2015-08-30 06:35:30 -0500
commitf1f20b9306ed3658e9433e00e78f2ac640d0160d (patch)
treefda6dc67905671272119bf9e2095c43886e01737 /toys/posix/cp.c
parente96dd0716e5932625af9e8a91bfa3d989abe1fdb (diff)
downloadtoybox-f1f20b9306ed3658e9433e00e78f2ac640d0160d.tar.gz
Fix mv on overwrite.
We need to remove the destination, not the source, to be able to overwrite.
Diffstat (limited to 'toys/posix/cp.c')
-rw-r--r--toys/posix/cp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toys/posix/cp.c b/toys/posix/cp.c
index d5e92f20..5a55f40b 100644
--- a/toys/posix/cp.c
+++ b/toys/posix/cp.c
@@ -382,7 +382,7 @@ void cp_main(void)
{
fprintf(stderr, "%s: overwrite '%s'", toys.which->name, TT.destname);
if (!yesno("", 1)) rc = 0;
- else unlink(src);
+ else unlink(TT.destname);
}
}