From 4a4c2eeb5d09265d5332ea0fc7ba7ebadebbd05b Mon Sep 17 00:00:00 2001 From: Colin Patrick McCabe Date: Thu, 10 Feb 2011 05:49:49 -0800 Subject: [PATCH] mds/Dumper: use safe_write Signed-off-by: Colin McCabe --- src/mds/Dumper.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mds/Dumper.cc b/src/mds/Dumper.cc index 15e0e773e9444..4fff5b77fdd33 100644 --- a/src/mds/Dumper.cc +++ b/src/mds/Dumper.cc @@ -12,11 +12,12 @@ * */ +#include "common/errno.h" +#include "common/safe_io.h" #include "mds/Dumper.h" -#include "osdc/Journaler.h" #include "mds/mdstypes.h" #include "mon/MonClient.h" -#include "common/errno.h" +#include "osdc/Journaler.h" Dumper::~Dumper() { @@ -113,8 +114,9 @@ void Dumper::dump(const char *dump_file) (unsigned long long)start, (unsigned long long)start, (unsigned long long)bl.length(), (unsigned long long)bl.length(), 4); - int r = ::write(fd, buf, sizeof(buf)); - assert(r >= 0); + int r = safe_write(fd, buf, sizeof(buf)); + if (r) + ceph_abort(); // write the data ::lseek64(fd, start, SEEK_SET); -- 2.39.5