From: Martin v. Löwis Date: Tue, 17 Sep 2002 07:05:25 +0000 (+0000) Subject: Deal with a NULL gr_passwd. Reported by Anders Qvist. X-Git-Tag: v2.3c1~4046 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ceb7c18c109bff48d5c3327c0ed9209b68540655;p=python Deal with a NULL gr_passwd. Reported by Anders Qvist. --- diff --git a/Modules/grpmodule.c b/Modules/grpmodule.c index 8a889685fc..2882fabd13 100644 --- a/Modules/grpmodule.c +++ b/Modules/grpmodule.c @@ -58,7 +58,12 @@ mkgrent(struct group *p) #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