svn commit: trunk/busybox/libbb

vda at busybox.net vda at busybox.net
Mon Aug 27 17:02:19 UTC 2007


Author: vda
Date: 2007-08-27 10:02:19 -0700 (Mon, 27 Aug 2007)
New Revision: 19706

Log:
cp: fix recursion check to not waste bytes remembering names of dirs



Modified:
   trunk/busybox/libbb/copy_file.c


Changeset:
Modified: trunk/busybox/libbb/copy_file.c
===================================================================
--- trunk/busybox/libbb/copy_file.c	2007-08-27 16:51:30 UTC (rev 19705)
+++ trunk/busybox/libbb/copy_file.c	2007-08-27 17:02:19 UTC (rev 19706)
@@ -114,7 +114,7 @@
 
 	if (S_ISDIR(source_stat.st_mode)) {
 		DIR *dp;
-		const char *existing_name;
+		const char *tp;
 		struct dirent *d;
 		mode_t saved_umask = 0;
 
@@ -124,11 +124,11 @@
 		}
 
 		/* Did we ever create source ourself before? */
-		existing_name = is_in_ino_dev_hashtable(&source_stat);
-		if (existing_name) {
+		tp = is_in_ino_dev_hashtable(&source_stat);
+		if (tp) {
 			/* We did! it's a recursion! man the lifeboats... */
 			bb_error_msg("recursion detected, omitting directory '%s'",
-					existing_name);
+					source);
 			return -1;
 		}
 
@@ -222,8 +222,7 @@
 		int dst_fd;
 
 		if (ENABLE_FEATURE_PRESERVE_HARDLINKS && !FLAGS_DEREF) {
-			char *link_target;
-
+			const char *link_target;
 			link_target = is_in_ino_dev_hashtable(&source_stat);
 			if (link_target) {
 				if (link(link_target, dest) < 0) {




More information about the busybox-cvs mailing list