Re: Further adventures in the land of 64-bit linux

[email protected] (Martin v. Löwis) 16 Sep 2002 16:01:31 +0200
Newsgroups gmane.comp.python.snake-farm.user
Message-ID <[email protected]>
Anders Qvist <[email protected]> writes:

> > I'm guessing that it's possible that the gr_passwd slot can be NULL on
> > that platform; the code doesn't expect this.

Can you please try the attached patch?

Thanks,
Martin

Index: grpmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/grpmodule.c,v
retrieving revision 2.19
diff -u -r2.19 grpmodule.c
--- grpmodule.c	2 Aug 2002 02:27:13 -0000	2.19
+++ grpmodule.c	16 Sep 2002 13:58:56 -0000
@@ -58,7 +58,12 @@
 
 #define SET(i,val) PyStructSequence_SET_ITEM(v, i, val)
     SET(setIndex++, PyString_FromString(p->gr_name));
-    SET(setIndex++, PyString_FromString(p->gr_passwd));
+    if (p->gr_passwd)
+	    SET(setIndex++, PyString_FromString(p->gr_passwd));
+    else {
+	    SET(setIndex++, Py_None);
+	    Py_INCREF(Py_None);
+    }
     SET(setIndex++, PyInt_FromLong((long) p->gr_gid));
     SET(setIndex++, w);
 #undef SET