diff options
author | Denis Vlasenko | 2007-03-14 22:06:01 +0000 |
---|---|---|
committer | Denis Vlasenko | 2007-03-14 22:06:01 +0000 |
commit | 6ef06eeed435eee87a5b6141d1ad445174e8019b (patch) | |
tree | 4e83de1e390e6b6e52befcbb4a9ab9cad553021f /libbb/copy_file.c | |
parent | 75ab6af71edb9e0e919a4e1e65bd7b45da93935b (diff) | |
download | busybox-6ef06eeed435eee87a5b6141d1ad445174e8019b.zip busybox-6ef06eeed435eee87a5b6141d1ad445174e8019b.tar.gz |
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 07564af..636fbdc 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); } |