From bbb69cb145babf48bd48c30bcb9c1ee9499d3ad8 Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Sat, 28 May 2016 12:26:16 +0800 Subject: [PATCH] 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 --- src/global/pidfile.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/global/pidfile.cc b/src/global/pidfile.cc index 383181ee1ede..23cca35bf964 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) { -- 2.47.3