From: xie xingguo Date: Sat, 28 May 2016 04:26:16 +0000 (+0800) Subject: global: negative error return code for pidfh::write() X-Git-Tag: v11.0.0~165^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bbb69cb145babf48bd48c30bcb9c1ee9499d3ad8;p=ceph.git global: negative error return code for pidfh::write() 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 --- diff --git a/src/global/pidfile.cc b/src/global/pidfile.cc index 383181ee1ed..23cca35bf96 100644 --- a/src/global/pidfile.cc +++ b/src/global/pidfile.cc @@ -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) {