aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Fernando J. Pereda <ferdy@ferdyx.org> 2007-10-09 19:34:14 +0000
committerAvatar Fernando J. Pereda <ferdy@ferdyx.org> 2007-10-09 19:34:14 +0000
commitc21ac6cc7c435dd5691b68423aaa81236dde6103 (patch)
treee2a6378de054236b042c02835222ade181746d1f
parent67a49f11f1645be945d9aba61b657075d08af430 (diff)
downloadpaludis-c21ac6cc7c435dd5691b68423aaa81236dde6103.tar.gz
paludis-c21ac6cc7c435dd5691b68423aaa81236dde6103.tar.xz
Correctly report read/write errors while merging files. Fixes ticket:349
-rw-r--r--paludis/merger.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/paludis/merger.cc b/paludis/merger.cc
index 8bb56e4..b7c1d04 100644
--- a/paludis/merger.cc
+++ b/paludis/merger.cc
@@ -29,6 +29,8 @@
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
+#include <errno.h>
+#include <cstring>
using namespace paludis;
@@ -634,7 +636,10 @@ Merger::install_file(const FSEntry & src, const FSEntry & dst_dir, const std::st
char buf[4096];
ssize_t count;
while ((count = read(input_fd, buf, 4096)) > 0)
- write(output_fd, buf, count);
+ 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 != _options.environment->perform_hook(extend_hook(
Hook("merger_install_file_post")