From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KggUg-0002cQ-PX for qemu-devel@nongnu.org; Fri, 19 Sep 2008 09:57:58 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KggUg-0002bB-6Q for qemu-devel@nongnu.org; Fri, 19 Sep 2008 09:57:58 -0400 Received: from [199.232.76.173] (port=39591 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KggUg-0002au-1z for qemu-devel@nongnu.org; Fri, 19 Sep 2008 09:57:58 -0400 Received: from [84.20.150.76] (port=58176 helo=narury.org) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KggUg-0000y0-2e for qemu-devel@nongnu.org; Fri, 19 Sep 2008 09:57:58 -0400 Received: from kos.to (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by narury.org (Postfix) with ESMTP id 5FBFF3274001 for ; Fri, 19 Sep 2008 16:57:52 +0300 (EEST) Date: Fri, 19 Sep 2008 16:57:52 +0300 From: Riku Voipio Subject: Re: [Qemu-devel] [PATCH] Fix getgroups() syscall emulation Message-ID: <20080919135752.GA21479@kos.to> References: <1221750426-14863-1-git-send-email-kirill@shutemov.name> <1221750426-14863-2-git-send-email-kirill@shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1221750426-14863-2-git-send-email-kirill@shutemov.name> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On Thu, Sep 18, 2008 at 06:07:00PM +0300, Kirill A. Shutemov wrote: > According to man page getgroups(2): > > If size is zero, list is not modified, but the total number of > supplementary group IDs for the process is returned. Looks ok to me. > Signed-off-by: Kirill A. Shutemov > --- > linux-user/syscall.c | 4 ++++ > 1 files changed, 4 insertions(+), 0 deletions(-) > > diff --git a/linux-user/syscall.c b/linux-user/syscall.c > index 124d14e..948ea3b 100644 > --- a/linux-user/syscall.c > +++ b/linux-user/syscall.c > @@ -5247,6 +5247,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, > > grouplist = alloca(gidsetsize * sizeof(gid_t)); > ret = get_errno(getgroups(gidsetsize, grouplist)); > + if (gidsetsize == 0) > + break; > if (!is_error(ret)) { > target_grouplist = lock_user(VERIFY_WRITE, arg2, gidsetsize * 2, 0); > if (!target_grouplist) > @@ -5397,6 +5399,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, > > grouplist = alloca(gidsetsize * sizeof(gid_t)); > ret = get_errno(getgroups(gidsetsize, grouplist)); > + if (gidsetsize == 0) > + break; > if (!is_error(ret)) { > target_grouplist = lock_user(VERIFY_WRITE, arg2, gidsetsize * 4, 0); > if (!target_grouplist) { > -- > 1.5.6.5.GIT > > -- "rm -rf" only sounds scary if you don't have backups