aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-10-08 16:30:18 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-10-08 16:30:18 +0100
commit203a470e881a367029d3c82242305795a28b5c3e (patch)
treea752ed8a1eb420c6572d3c2bafe468c6cea89208
parent2856841b1949ab5e1287ba3f31ab4c57e45c0c7b (diff)
downloadpaludis-203a470e881a367029d3c82242305795a28b5c3e.tar.gz
paludis-203a470e881a367029d3c82242305795a28b5c3e.tar.xz
XFS fallocate clobbers set*id bits
-rw-r--r--paludis/fs_merger.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/paludis/fs_merger.cc b/paludis/fs_merger.cc
index 57413f5..63fb98a 100644
--- a/paludis/fs_merger.cc
+++ b/paludis/fs_merger.cc
@@ -390,11 +390,6 @@ FSMerger::install_file(const FSPath & src, const FSPath & dst_dir, const std::st
if (0 != ::fchown(output_fd, src_stat.owner(), src_stat.group()))
throw FSMergerError("Cannot fchown '" + stringify(dst) + "': " + stringify(::strerror(errno)));
- /* set*id bits */
- if (0 != ::fchmod(output_fd, src_perms))
- throw FSMergerError("Cannot fchmod '" + stringify(dst) + "': " + stringify(::strerror(errno)));
- try_to_copy_xattrs(src, output_fd, result);
-
#ifdef HAVE_FALLOCATE
if (0 != ::fallocate(output_fd, FALLOC_FL_KEEP_SIZE, 0, src_stat.file_size()))
switch (errno)
@@ -413,6 +408,11 @@ FSMerger::install_file(const FSPath & src, const FSPath & dst_dir, const std::st
}
#endif
+ /* set*id bits, after fallocate because xfs is weird */
+ if (0 != ::fchmod(output_fd, src_perms))
+ throw FSMergerError("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)