From ceb7c18c109bff48d5c3327c0ed9209b68540655 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Tue, 17 Sep 2002 07:05:25 +0000 Subject: [PATCH] Deal with a NULL gr_passwd. Reported by Anders Qvist. --- Modules/grpmodule.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- 2.40.0