From patchwork Wed Oct 10 11:32:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 190615 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 21D0B2C0089 for ; Wed, 10 Oct 2012 22:33:16 +1100 (EST) Received: from localhost ([::1]:38371 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLuXK-0002HT-9Z for incoming@patchwork.ozlabs.org; Wed, 10 Oct 2012 07:33:14 -0400 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 Received: from mail-pb0-f45.google.com ([209.85.160.45]:62576) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLuWy-0008TX-9v; Wed, 10 Oct 2012 07:32:52 -0400 Received: by mail-pb0-f45.google.com with SMTP id rp2so605877pbb.4 for ; Wed, 10 Oct 2012 04:32:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:mime-version :content-type:content-transfer-encoding; bh=EGqQqnGlRfzsHHOvTk8pZKfv4wDxNBdpyPYjglRrou0=; b=U6+M/U7DgS+od/m4W8BNqLm7P2S7J0x8c4vEv+D4NRvBASki+leyPOGqRqcc/Sq67N 4wrrbhSsELIesCAECOLu1l7Q/q73NVqn3o8AtyGfVrM52D8aHlZHr2AsHdiBkGrkNhw7 InILwSS7QFYSJYm6iHdy71GY8R6qq5LcolGMxipHUHbPiZADetil0zBbHTkgwAWKnQDL OrUhn3ut3zRN8Vzh4K6zfeU6tqyWpYeIHpGVrKPRFbl7aF/fOYTXYkEj5sCl1asxPEYZ Iwzt5VBbtEtm3hoxNMzuRFl03itzlk5Gm7fj7i7KF9QKcefTZGGm/hob0sYgYSOvh0/M 63rQ== Received: by 10.68.225.5 with SMTP id rg5mr72224549pbc.73.1349868771371; Wed, 10 Oct 2012 04:32:51 -0700 (PDT) Received: from yakj.usersys.redhat.com (93-34-169-1.ip50.fastwebnet.it. [93.34.169.1]) by mx.google.com with ESMTPS id w10sm732346paz.22.2012.10.10.04.32.49 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 10 Oct 2012 04:32:50 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 10 Oct 2012 13:32:42 +0200 Message-Id: <1349868762-10021-1-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.12.1 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.45 Cc: qemu-trivial@nongnu.org Subject: [Qemu-devel] [PATCH] virtfs-proxy-helper: check return code of setfsgid/setfsuid X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@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);