mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
Issue #20306: The pw_gecos and pw_passwd fields are not required by POSIX.
If they aren't present, set them to an empty string.
This commit is contained in:
parent
8e1da5823b
commit
267b639a26
4 changed files with 45 additions and 0 deletions
|
|
@ -75,10 +75,18 @@ mkpwent(struct passwd *p)
|
|||
#define SETS(i,val) sets(v, i, val)
|
||||
|
||||
SETS(setIndex++, p->pw_name);
|
||||
#if defined(HAVE_STRUCT_PASSWD_PW_PASSWD)
|
||||
SETS(setIndex++, p->pw_passwd);
|
||||
#else
|
||||
SETS(setIndex++, "");
|
||||
#endif
|
||||
PyStructSequence_SET_ITEM(v, setIndex++, _PyLong_FromUid(p->pw_uid));
|
||||
PyStructSequence_SET_ITEM(v, setIndex++, _PyLong_FromGid(p->pw_gid));
|
||||
#if defined(HAVE_STRUCT_PASSWD_PW_GECOS)
|
||||
SETS(setIndex++, p->pw_gecos);
|
||||
#else
|
||||
SETS(setIndex++, "");
|
||||
#endif
|
||||
SETS(setIndex++, p->pw_dir);
|
||||
SETS(setIndex++, p->pw_shell);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue