aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2009-12-13 16:55:21 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2009-12-13 16:55:21 +0000
commiteed895d5762216657d897196cc6dced9a9eb3225 (patch)
treed65ee47a5e1ace52e005201692e94a86b26e0346
parenta6fa5939105c5c2a84952120908f81aa4f8316f9 (diff)
downloadpaludis-eed895d5762216657d897196cc6dced9a9eb3225.tar.gz
paludis-eed895d5762216657d897196cc6dced9a9eb3225.tar.xz
mtime needs to be set after writing
-rw-r--r--paludis/merger.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/paludis/merger.cc b/paludis/merger.cc
index d90b1a8..8a180d4 100644
--- a/paludis/merger.cc
+++ b/paludis/merger.cc
@@ -799,6 +799,14 @@ Merger::install_file(const FSEntry & src, const FSEntry & dst_dir, const std::st
throw MergerError("Cannot fchmod '" + stringify(dst) + "': " + stringify(::strerror(errno)));
try_to_copy_xattrs(src, output_fd, result);
+ char buf[4096];
+ ssize_t count;
+ while ((count = read(input_fd, buf, 4096)) > 0)
+ if (-1 == write(output_fd, buf, count))
+ throw MergerError("write failed: " + stringify(::strerror(errno)));
+ if (-1 == count)
+ throw MergerError("read failed: " + stringify(::strerror(errno)));
+
/* might need to copy mtime */
if (_imp->params.options()[mo_preserve_mtimes])
{
@@ -810,14 +818,6 @@ Merger::install_file(const FSEntry & src, const FSEntry & dst_dir, const std::st
throw MergerError("Cannot futimens '" + stringify(dst) + "': " + stringify(::strerror(errno)));
}
- char buf[4096];
- ssize_t count;
- while ((count = read(input_fd, buf, 4096)) > 0)
- if (-1 == write(output_fd, buf, count))
- throw MergerError("write failed: " + stringify(::strerror(errno)));
- if (-1 == count)
- throw MergerError("read failed: " + stringify(::strerror(errno)));
-
if (0 != std::rename(stringify(dst).c_str(), stringify(dst_real).c_str()))
throw MergerError(
"rename(" + stringify(dst) + ", " + stringify(dst_real) + ") failed: " + stringify(::strerror(errno)));