From ce7b5ea7d5c30be32e4448ab0e7e6bb6147af548 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 17 Jun 2013 20:32:15 -0700 Subject: [PATCH] common/Preforker: fix warning MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit common/Preforker.h: In member function ‘int Preforker::signal_exit(int)’: warning: common/Preforker.h:82:45: ignoring return value of ‘ssize_t safe_write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result] This is harder than it should be to fix. :( http://stackoverflow.com/questions/3614691/casting-to-void-doesnt-remove-warn-unused-result-error Whatever, I guess we can do something useful with this return value. Signed-off-by: Sage Weil Reviewed-by: David Zafman --- src/common/Preforker.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/common/Preforker.h b/src/common/Preforker.h index 2c1d4fd67956..98304c632b71 100644 --- a/src/common/Preforker.h +++ b/src/common/Preforker.h @@ -78,8 +78,11 @@ public: int signal_exit(int r) { if (forked) { - // tell parent - (void)safe_write(fd[1], &r, sizeof(r)); + // tell parent. this shouldn't fail, but if it does, pass the + // error back to the parent. + int ret = safe_write(fd[1], &r, sizeof(r)); + if (ret <= 0) + return ret; } return r; } -- 2.47.3