From: Sage Weil Date: Tue, 18 Jun 2013 03:32:15 +0000 (-0700) Subject: common/Preforker: fix warning X-Git-Tag: v0.65~44 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ce7b5ea7d5c30be32e4448ab0e7e6bb6147af548;p=ceph.git common/Preforker: fix warning 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 --- 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; }