diff options
author | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2005-07-20 00:45:40 +0000 |
---|---|---|
committer | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2005-07-20 00:45:40 +0000 |
commit | e692191a7b5ad963e0c29b7db83e5e14b693c4bd (patch) | |
tree | f03892cf7bdd37148841e4b4caa3720f67da38d1 | |
parent | 2ddab789c65afa40f7c8f9c3cb58118a5fc91b44 (diff) | |
download | busybox-w32-e692191a7b5ad963e0c29b7db83e5e14b693c4bd.tar.gz busybox-w32-e692191a7b5ad963e0c29b7db83e5e14b693c4bd.tar.bz2 busybox-w32-e692191a7b5ad963e0c29b7db83e5e14b693c4bd.zip |
If /tmp and /home were different partitions, then "mv /tmp/file /home/file"
would delete /home/file even if /tmp/file didn't exist.
This fixes that, although the logic of both mv and cp is a bit tangled and
should probably be untangled.
git-svn-id: svn://busybox.net/trunk/busybox@10868 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r-- | coreutils/mv.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/coreutils/mv.c b/coreutils/mv.c index 4f08dedc0..e1c4529ad 100644 --- a/coreutils/mv.c +++ b/coreutils/mv.c | |||
@@ -99,10 +99,10 @@ DO_MOVE: | |||
99 | struct stat source_stat; | 99 | struct stat source_stat; |
100 | int source_exists; | 100 | int source_exists; |
101 | 101 | ||
102 | if (errno != EXDEV) { | 102 | if (errno != EXDEV || |
103 | (source_exists = cp_mv_stat(*argv, &source_stat)) < 1) { | ||
103 | bb_perror_msg("unable to rename `%s'", *argv); | 104 | bb_perror_msg("unable to rename `%s'", *argv); |
104 | } | 105 | } else { |
105 | else if ((source_exists = cp_mv_stat(*argv, &source_stat)) >= 0) { | ||
106 | if (dest_exists) { | 106 | if (dest_exists) { |
107 | if (dest_exists == 3) { | 107 | if (dest_exists == 3) { |
108 | if (source_exists != 3) { | 108 | if (source_exists != 3) { |