aboutsummaryrefslogtreecommitdiff
path: root/libbb/copy_file.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-03-14 22:06:01 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-03-14 22:06:01 +0000
commit6ef06eeed435eee87a5b6141d1ad445174e8019b (patch)
tree4e83de1e390e6b6e52befcbb4a9ab9cad553021f /libbb/copy_file.c
parent75ab6af71edb9e0e919a4e1e65bd7b45da93935b (diff)
downloadbusybox-w32-6ef06eeed435eee87a5b6141d1ad445174e8019b.tar.gz
busybox-w32-6ef06eeed435eee87a5b6141d1ad445174e8019b.tar.bz2
busybox-w32-6ef06eeed435eee87a5b6141d1ad445174e8019b.zip
stop using big static buffer for inode hash
Diffstat (limited to 'libbb/copy_file.c')
-rw-r--r--libbb/copy_file.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/libbb/copy_file.c b/libbb/copy_file.c
index 07564afd0..636fbdc1d 100644
--- a/libbb/copy_file.c
+++ b/libbb/copy_file.c
@@ -172,22 +172,21 @@ int copy_file(const char *source, const char *dest, int flags)
172 if (ENABLE_FEATURE_PRESERVE_HARDLINKS) { 172 if (ENABLE_FEATURE_PRESERVE_HARDLINKS) {
173 char *link_name; 173 char *link_name;
174 174
175 if (!FLAGS_DEREF 175 if (!FLAGS_DEREF) {
176 && is_in_ino_dev_hashtable(&source_stat, &link_name) 176 link_name = is_in_ino_dev_hashtable(&source_stat);
177 ) { 177 if (link_name) {
178 if (link(link_name, dest) < 0) {
179 ovr = retry_overwrite(dest, flags);
180 if (ovr <= 0)
181 return ovr;
182 if (link(link_name, dest) < 0) { 178 if (link(link_name, dest) < 0) {
183 bb_perror_msg("cannot create link '%s'", dest); 179 ovr = retry_overwrite(dest, flags);
184 return -1; 180 if (ovr <= 0)
181 return ovr;
182 if (link(link_name, dest) < 0) {
183 bb_perror_msg("cannot create link '%s'", dest);
184 return -1;
185 }
185 } 186 }
187 return 0;
186 } 188 }
187 return 0;
188 } 189 }
189 // TODO: probably is_in_.. and add_to_...
190 // can be combined: find_or_add_...
191 add_to_ino_dev_hashtable(&source_stat, dest); 190 add_to_ino_dev_hashtable(&source_stat, dest);
192 } 191 }
193 192