qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] syscall getgroups() optimization
@ 2007-06-25 21:05 Kirill A. Shutemov
  2007-06-29 21:07 ` Kirill A. Shutemov
  0 siblings, 1 reply; 2+ messages in thread
From: Kirill A. Shutemov @ 2007-06-25 21:05 UTC (permalink / raw)
  To: qemu-devel


[-- Attachment #1.1: Type: text/plain, Size: 283 bytes --]

On success, getgroups() returns the number of supplementary group IDs. So, 
we can swap real number group IDs.

Patch in the attachment.

-- 
Regards,  Kirill A. Shutemov
 + Belarus, Minsk
 + Velesys LLC, http://www.velesys.com/
 + ALT Linux Team, http://www.altlinux.com/

[-- Attachment #1.2: qemu-0.9.0-alt-getgroups.patch --]
[-- Type: text/plain, Size: 996 bytes --]

--- qemu/linux-user/syscall.c	2007-05-08 12:42:50 +0300
+++ qemu-0.9.0.cvs20070420/linux-user/syscall.c	2007-05-20 21:13:06 +0300
@@ -3741,7 +4144,7 @@
             ret = get_errno(getgroups(gidsetsize, grouplist));
             if (!is_error(ret)) {
                 target_grouplist = lock_user(arg2, gidsetsize * 2, 0);
-                for(i = 0;i < gidsetsize; i++)
+                for(i = 0;i < ret; i++)
                     target_grouplist[i] = tswap16(grouplist[i]);
                 unlock_user(target_grouplist, arg2, gidsetsize * 2);
             }
@@ -3873,7 +4276,7 @@
             ret = get_errno(getgroups(gidsetsize, grouplist));
             if (!is_error(ret)) {
                 target_grouplist = lock_user(arg2, gidsetsize * 4, 0);
-                for(i = 0;i < gidsetsize; i++)
+                for(i = 0;i < ret; i++)
                     target_grouplist[i] = tswap32(grouplist[i]);
                 unlock_user(target_grouplist, arg2, gidsetsize * 4);
             }

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-06-29 21:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-25 21:05 [Qemu-devel] [PATCH] syscall getgroups() optimization Kirill A. Shutemov
2007-06-29 21:07 ` Kirill A. Shutemov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).