]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds/Dumper: use safe_write
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Thu, 10 Feb 2011 13:49:49 +0000 (05:49 -0800)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Thu, 10 Feb 2011 13:55:10 +0000 (05:55 -0800)
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
src/mds/Dumper.cc

index 15e0e773e944414ba2ac689ed414f9aa6adfbffc..4fff5b77fdd338fbf9bd22d107f673c2ff8fae3f 100644 (file)
  * 
  */
 
+#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);