]> granicus.if.org Git - python/commitdiff
Deal with a NULL gr_passwd. Reported by Anders Qvist.
authorMartin v. Löwis <martin@v.loewis.de>
Tue, 17 Sep 2002 07:05:25 +0000 (07:05 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Tue, 17 Sep 2002 07:05:25 +0000 (07:05 +0000)
Modules/grpmodule.c

index 8a889685fcf9223cfd42bd09f4e389722f651af3..2882fabd13308f8eb01bccaf19da22ae87cca51a 100644 (file)
@@ -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