[BusyBox-cvs] svn commit: trunk/busybox/coreutils

landley at busybox.net landley at busybox.net
Wed Jul 20 00:45:41 UTC 2005


Author: landley
Date: 2005-07-19 18:45:40 -0600 (Tue, 19 Jul 2005)
New Revision: 10868

Log:
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.


Modified:
   trunk/busybox/coreutils/mv.c


Changeset:
Modified: trunk/busybox/coreutils/mv.c
===================================================================
--- trunk/busybox/coreutils/mv.c	2005-07-19 21:31:05 UTC (rev 10867)
+++ trunk/busybox/coreutils/mv.c	2005-07-20 00:45:40 UTC (rev 10868)
@@ -99,10 +99,10 @@
 			struct stat source_stat;
 			int source_exists;
 
-			if (errno != EXDEV) {
+			if (errno != EXDEV ||
+				(source_exists = cp_mv_stat(*argv, &source_stat)) < 1) {
 				bb_perror_msg("unable to rename `%s'", *argv);
-			}
-			else if ((source_exists = cp_mv_stat(*argv, &source_stat)) >= 0) {
+			} else {
 				if (dest_exists) {
 					if (dest_exists == 3) {
 						if (source_exists != 3) {




More information about the busybox-cvs mailing list