*** Modules/posixmodule.c.old Wed Jan 16 01:20:29 2008 --- Modules/posixmodule.c Wed Jan 16 01:33:04 2008 *************** *** 1881,1889 **** posix_chown(PyObject *self, PyObject *args) { char *path = NULL; ! int uid, gid; int res; ! if (!PyArg_ParseTuple(args, "etii:chown", Py_FileSystemDefaultEncoding, &path, &uid, &gid)) return NULL; --- 1881,1918 ---- posix_chown(PyObject *self, PyObject *args) { char *path = NULL; ! uid_t uid; ! gid_t gid; int res; ! static char dynamic_format[11]; ! static int dynamic_format_initialized = 0; ! ! if (!dynamic_format_initialized) { ! strcpy(dynamic_format, "etii:chown"); ! if (sizeof(uid_t) == sizeof(int) && (uid_t) 0 - 1 > 0) ! dynamic_format[2] = 'I'; ! else if (sizeof(uid_t) == sizeof(short) && (uid_t) 0 - 1 < 0) ! dynamic_format[2] = 'h'; ! else if (sizeof(uid_t) == sizeof(short) && (uid_t) 0 - 1 > 0) ! dynamic_format[2] = 'H'; ! else if (sizeof(uid_t) == sizeof(long) && (uid_t) 0 - 1 < 0) ! dynamic_format[2] = 'l'; ! else if (sizeof(uid_t) == sizeof(long) && (uid_t) 0 - 1 > 0) ! dynamic_format[2] = 'k'; ! if (sizeof(gid_t) == sizeof(int) && (gid_t) 0 - 1 > 0) ! dynamic_format[3] = 'I'; ! else if (sizeof(gid_t) == sizeof(short) && (gid_t) 0 - 1 < 0) ! dynamic_format[3] = 'h'; ! else if (sizeof(gid_t) == sizeof(short) && (gid_t) 0 - 1 > 0) ! dynamic_format[3] = 'H'; ! else if (sizeof(gid_t) == sizeof(long) && (gid_t) 0 - 1 < 0) ! dynamic_format[3] = 'l'; ! else if (sizeof(gid_t) == sizeof(long) && (gid_t) 0 - 1 > 0) ! dynamic_format[3] = 'k'; ! dynamic_format_initialized = 1; ! } ! ! if (!PyArg_ParseTuple(args, dynamic_format, Py_FileSystemDefaultEncoding, &path, &uid, &gid)) return NULL;