]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
global: negative error return code for pidfh::write() 9378/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Sat, 28 May 2016 04:26:16 +0000 (12:26 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Mon, 6 Jun 2016 10:38:58 +0000 (18:38 +0800)
Global callers such as global_init_prefork() won't catch postive
error codes:

    if (pidfile_write(conf) < 0)
      exit(1);

Fixes: http://tracker.ceph.com/issues/16159
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/global/pidfile.cc

index 383181ee1edeeeb385adea40f4588bc4279ad26d..23cca35bf96474c9c2a36527b7009210c689b84a 100644 (file)
@@ -185,7 +185,7 @@ int pidfh::write()
     int err = errno;
     derr << __func__ << ": failed to ftruncate the pid file '"
         << pf_path << "': " << cpp_strerror(err) << dendl;
-    return err;
+    return -err;
   }
   ssize_t res = safe_write(pf_fd, buf, len);
   if (res < 0) {