diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-03-15 01:06:01 +0300 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-03-15 01:06:01 +0300 |
commit | 6ef06eeed435eee87a5b6141d1ad445174e8019b (patch) | |
tree | 4e83de1e390e6b6e52befcbb4a9ab9cad553021f /libbb/copy_file.c | |
parent | 75ab6af71edb9e0e919a4e1e65bd7b45da93935b (diff) |
stop using big static buffer for inode hash
Diffstat (limited to 'libbb/copy_file.c')
-rw-r--r-- | libbb/copy_file.c | 23 |
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) if (ENABLE_FEATURE_PRESERVE_HARDLINKS) { char *link_name; - if (!FLAGS_DEREF - && is_in_ino_dev_hashtable(&source_stat, &link_name) - ) { - if (link(link_name, dest) < 0) { - ovr = retry_overwrite(dest, flags); - if (ovr <= 0) - return ovr; + if (!FLAGS_DEREF) { + link_name = is_in_ino_dev_hashtable(&source_stat); + if (link_name) { if (link(link_name, dest) < 0) { - bb_perror_msg("cannot create link '%s'", dest); - return -1; + ovr = retry_overwrite(dest, flags); + if (ovr <= 0) + return ovr; + if (link(link_name, dest) < 0) { + bb_perror_msg("cannot create link '%s'", dest); + return -1; + } } + return 0; } - return 0; } - // TODO: probably is_in_.. and add_to_... - // can be combined: find_or_add_... add_to_ino_dev_hashtable(&source_stat, dest); } |