From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:47511) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLuX7-0002Gb-US for qemu-devel@nongnu.org; Wed, 10 Oct 2012 07:33:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TLuWy-0008Tb-GI for qemu-devel@nongnu.org; Wed, 10 Oct 2012 07:33:01 -0400 Sender: Paolo Bonzini From: Paolo Bonzini Date: Wed, 10 Oct 2012 13:32:42 +0200 Message-Id: <1349868762-10021-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH] virtfs-proxy-helper: check return code of setfsgid/setfsuid List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org Fixes the following error with glibc 2.16 on Fedora 18: virtfs-proxy-helper.c: In function ‘setfsugid’: virtfs-proxy-helper.c:293:13: error: ignoring return value of ‘setfsgid’, declared with attribute warn_unused_result [-Werror=unused-result] virtfs-proxy-helper.c:294:13: error: ignoring return value of ‘setfsuid’, declared with attribute warn_unused_result [-Werror=unused-result] cc1: all warnings being treated as errors Signed-off-by: Paolo Bonzini --- fsdev/virtfs-proxy-helper.c | 8 ++++++-- 1 file modificato, 6 inserzioni(+), 2 rimozioni(-) diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c index f9a8270..b34a84a 100644 --- a/fsdev/virtfs-proxy-helper.c +++ b/fsdev/virtfs-proxy-helper.c @@ -290,8 +290,12 @@ static int setfsugid(int uid, int gid) CAP_DAC_OVERRIDE, }; - setfsgid(gid); - setfsuid(uid); + if (setfsgid(gid) != 0) { + return -1; + } + if (setfsuid(uid) != 0) { + return -1; + } if (uid != 0 || gid != 0) { return do_cap_set(cap_list, ARRAY_SIZE(cap_list), 0); -- 1.7.12.1