Alexander Belopolsky <alexander.belopol...@gmail.com> added the comment:
On Tue, Feb 23, 2010 at 8:46 AM, Ronald Oussoren <rep...@bugs.python.org> wrote: > .. > I get test failures, but no crashes, when I do run the additional tests. The crash that I see is apparently due to underallocated memory: alt_grouplist = PyMem_Malloc(n); should be alt_grouplist = PyMem_Malloc(n * sizeof(gid_t)); .. > I'm not too thrilled about your approach of growing the grouplist argument of > getgroups until the results fit, the comment in the coreutils sources refers > to two > very old unix flavors and IMHO it is not worthwhile to try to > support those. > You are probably right on this point, but the main issue with using getgroups(0, ..) is the race condition that it introduces. If another thread adds a group between n = getgroups(0, ..) and getgroups(n, ..) calls, the second call will fail. Makes sense regardless of the approach. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue7900> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com