aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Fernando J. Pereda <ferdy@ferdyx.org> 2008-06-03 12:32:28 +0000
committerAvatar Fernando J. Pereda <ferdy@ferdyx.org> 2008-06-03 12:32:28 +0000
commit6eebef2db35080b511e21754c0e0f39740a1405a (patch)
tree00710f3e3a7d7fe8a67d6ba5f16da3cadcfa26a2
parent02ab3c546eb82dabad18782d6bf2cf63d04b1384 (diff)
downloadpaludis-6eebef2db35080b511e21754c0e0f39740a1405a.tar.gz
paludis-6eebef2db35080b511e21754c0e0f39740a1405a.tar.xz
Don't touch hardlinks multiple times. Fixes ticket:589
-rw-r--r--paludis/merger.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/paludis/merger.cc b/paludis/merger.cc
index 7f00c00..8cee641 100644
--- a/paludis/merger.cc
+++ b/paludis/merger.cc
@@ -703,13 +703,15 @@ Merger::install_file(const FSEntry & src, const FSEntry & dst_dir, const std::st
if (0 == ::rename(stringify(src).c_str(), stringify(dst_real).c_str()))
{
result += msi_rename;
- if (! dst_real.utime())
+
+ bool touch(_imp->merged_ids.end() == _imp->merged_ids.find(src.lowlevel_id()));
+ _imp->merged_ids.insert(make_pair(src.lowlevel_id(), stringify(dst_real)));
+
+ if (touch && ! dst_real.utime())
throw MergerError("utime(" + stringify(dst_real) + ", 0) failed: " + stringify(::strerror(errno)));
/* set*id bits get partially clobbered on a rename on linux */
dst_real.chmod(src_perms);
-
- _imp->merged_ids.insert(make_pair(src.lowlevel_id(), stringify(dst_real)));
}
else
{
@@ -842,10 +844,13 @@ Merger::record_renamed_dir_recursive(const FSEntry & dst)
continue;
case et_file:
- if (! FSEntry(*d).utime())
+ {
+ bool touch(_imp->merged_ids.end() == _imp->merged_ids.find(d->lowlevel_id()));
+ _imp->merged_ids.insert(make_pair(d->lowlevel_id(), stringify(*d)));
+ if (touch && ! FSEntry(*d).utime())
throw MergerError("utime(" + stringify(*d) + ", 0) failed: " + stringify(::strerror(errno)));
record_install_file(*d, dst, stringify(d->basename()), MergeStatusFlags() + msi_parent_rename);
- _imp->merged_ids.insert(make_pair(d->lowlevel_id(), stringify(*d)));
+ }
continue;
case et_dir: