aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2014-11-30 09:50:05 +0000
committerRon Yorston <rmy@pobox.com>2014-11-30 09:50:05 +0000
commit7ef60bda00dc4b2fbccf67a40885569ab45eb7aa (patch)
tree3cc5422bcf037f0e14b46ebc395d4cd67bcae4de
parent084cca42dfa926e6fbf8a95b9adc1831647d3528 (diff)
downloadbusybox-w32-7ef60bda00dc4b2fbccf67a40885569ab45eb7aa.tar.gz
busybox-w32-7ef60bda00dc4b2fbccf67a40885569ab45eb7aa.tar.bz2
busybox-w32-7ef60bda00dc4b2fbccf67a40885569ab45eb7aa.zip
Don't store file details in inode hash table
-rw-r--r--libbb/copy_file.c6
-rw-r--r--libbb/inode_hash.c2
2 files changed, 2 insertions, 6 deletions
diff --git a/libbb/copy_file.c b/libbb/copy_file.c
index 935a9a4c4..a427c441f 100644
--- a/libbb/copy_file.c
+++ b/libbb/copy_file.c
@@ -142,7 +142,6 @@ int FAST_FUNC copy_file(const char *source, const char *dest, int flags)
142 } 142 }
143 143
144 /* Did we ever create source ourself before? */ 144 /* Did we ever create source ourself before? */
145#if !ENABLE_PLATFORM_MINGW32
146 tp = is_in_ino_dev_hashtable(&source_stat); 145 tp = is_in_ino_dev_hashtable(&source_stat);
147 if (tp) { 146 if (tp) {
148 /* We did! it's a recursion! man the lifeboats... */ 147 /* We did! it's a recursion! man the lifeboats... */
@@ -150,7 +149,6 @@ int FAST_FUNC copy_file(const char *source, const char *dest, int flags)
150 source); 149 source);
151 return -1; 150 return -1;
152 } 151 }
153#endif
154 152
155 if (dest_exists) { 153 if (dest_exists) {
156 if (!S_ISDIR(dest_stat.st_mode)) { 154 if (!S_ISDIR(dest_stat.st_mode)) {
@@ -181,11 +179,9 @@ int FAST_FUNC copy_file(const char *source, const char *dest, int flags)
181 return -1; 179 return -1;
182 } 180 }
183 } 181 }
184#if !ENABLE_PLATFORM_MINGW32
185 /* remember (dev,inode) of each created dir. 182 /* remember (dev,inode) of each created dir.
186 * NULL: name is not remembered */ 183 * NULL: name is not remembered */
187 add_to_ino_dev_hashtable(&dest_stat, NULL); 184 add_to_ino_dev_hashtable(&dest_stat, NULL);
188#endif
189 185
190 /* Recursively copy files in SOURCE */ 186 /* Recursively copy files in SOURCE */
191 dp = opendir(source); 187 dp = opendir(source);
@@ -255,7 +251,6 @@ int FAST_FUNC copy_file(const char *source, const char *dest, int flags)
255 goto dont_cat; 251 goto dont_cat;
256 } 252 }
257 253
258#if !ENABLE_PLATFORM_MINGW32
259 if (ENABLE_FEATURE_PRESERVE_HARDLINKS && !FLAGS_DEREF) { 254 if (ENABLE_FEATURE_PRESERVE_HARDLINKS && !FLAGS_DEREF) {
260 const char *link_target; 255 const char *link_target;
261 link_target = is_in_ino_dev_hashtable(&source_stat); 256 link_target = is_in_ino_dev_hashtable(&source_stat);
@@ -273,7 +268,6 @@ int FAST_FUNC copy_file(const char *source, const char *dest, int flags)
273 } 268 }
274 add_to_ino_dev_hashtable(&source_stat, dest); 269 add_to_ino_dev_hashtable(&source_stat, dest);
275 } 270 }
276#endif
277 271
278 src_fd = open_or_warn(source, O_RDONLY); 272 src_fd = open_or_warn(source, O_RDONLY);
279 if (src_fd < 0) 273 if (src_fd < 0)
diff --git a/libbb/inode_hash.c b/libbb/inode_hash.c
index f11c2afb2..64f43b885 100644
--- a/libbb/inode_hash.c
+++ b/libbb/inode_hash.c
@@ -59,6 +59,7 @@ char* FAST_FUNC is_in_ino_dev_hashtable(const struct stat *statbuf)
59/* Add statbuf to statbuf hash table */ 59/* Add statbuf to statbuf hash table */
60void FAST_FUNC add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name) 60void FAST_FUNC add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name)
61{ 61{
62#if !ENABLE_PLATFORM_MINGW32
62 int i; 63 int i;
63 ino_dev_hashtable_bucket_t *bucket; 64 ino_dev_hashtable_bucket_t *bucket;
64 65
@@ -76,6 +77,7 @@ void FAST_FUNC add_to_ino_dev_hashtable(const struct stat *statbuf, const char *
76 i = hash_inode(statbuf->st_ino); 77 i = hash_inode(statbuf->st_ino);
77 bucket->next = ino_dev_hashtable[i]; 78 bucket->next = ino_dev_hashtable[i];
78 ino_dev_hashtable[i] = bucket; 79 ino_dev_hashtable[i] = bucket;
80#endif
79} 81}
80 82
81#if ENABLE_DU || ENABLE_FEATURE_CLEAN_UP 83#if ENABLE_DU || ENABLE_FEATURE_CLEAN_UP