Re: Fix for Zope segfault on amd64
On Sat, Jan 22, 2005 at 09:49:50AM -0500, Per Bojsen wrote:
> --- /tmp/Zope-2.6.4-src/lib/Components/initgroups/initgroups.c 2002-07-25 17:54:02.000000000 -0400
> +++ lib/Components/initgroups/initgroups.c 2005-01-22 09:41:56.882300943 -0500
> @@ -23,12 +23,15 @@
> initgroups_initgroups(PyObject *self, PyObject *args)
> {
> char *username;
> - gid_t gid;
> + long gid;
>
> + /* Use a long to get the gid rather than gid_t to avoid
> + dependencies on 32-bit versus 64-bit architectures,
> + etc. */
> if (!PyArg_ParseTuple(args, "sl:initgroups", &username, &gid))
> return NULL;
>
> - if (initgroups(username, gid) == -1)
> + if (initgroups(username, (gid_t) gid) == -1)
> return PyErr_SetFromErrno(PyExc_OSError);
>
> Py_INCREF(Py_None);
>
> This should work on most common architectures, would you agree?
This is wrong. gid_t is 32 bits on all architectures.
You should use "si:initgroups" everytime and certainly not change the
gid type to a long.
--
Vincent Hanquez
Reply to: