]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cfuse.cc: use safe_write
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Thu, 10 Feb 2011 13:52:44 +0000 (05:52 -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/cfuse.cc

index 009bae7197de0b09de59b632e3e811ddadf72e2d..236de4adb983ce1cdff83804d4761b4afcae8d73 100644 (file)
@@ -28,6 +28,8 @@ using namespace std;
 
 #include "common/Timer.h"
 #include "common/common_init.h"
+#include "common/errno.h"
+#include "common/safe_io.h"
        
 #ifndef DARWIN
 #include <envz.h>
@@ -149,7 +151,13 @@ int main(int argc, const char **argv, const char *envp[]) {
 
     if (daemonize) {
       //cout << "child signalling parent with " << r << std::endl;
-      ::write(fd[1], &r, sizeof(r));
+      int32_t out = r;
+      int ret = safe_write(fd[1], &out, sizeof(out));
+      if (ret) {
+       derr << "cfuse[" << getpid() << "]: failed to write to fd[1]: "
+            << cpp_strerror(ret) << dendl;
+       ceph_abort();
+      }
     }
 
     //cout << "child done" << std::endl;