Ignore upper bits of pw_expire on macOS
`pw_expire` is declared as `time_t`, but actually not, and `getpwuid` returns a garbage there. Also the declaration of `struct passwd` in pwd.h and the manual page contradict each other, interal `pw_fields` is mentioned only in the latter. Maybe there is a confusion.
This commit is contained in:
parent
9af3469b84
commit
f099bb040c
@ -125,6 +125,12 @@ safe_setup_filesystem_str(const char *str)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GETPWENT
|
#ifdef HAVE_GETPWENT
|
||||||
|
# ifdef __APPLE__
|
||||||
|
# define PW_EXPIRE2VAL(t) INT2NUM((int)(t))
|
||||||
|
# else
|
||||||
|
# define PW_EXPIRE2VAL(t) TIMET2NUM(t)
|
||||||
|
# endif
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
setup_passwd(struct passwd *pwd)
|
setup_passwd(struct passwd *pwd)
|
||||||
{
|
{
|
||||||
@ -157,7 +163,7 @@ setup_passwd(struct passwd *pwd)
|
|||||||
safe_setup_locale_str(pwd->pw_comment),
|
safe_setup_locale_str(pwd->pw_comment),
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_STRUCT_PASSWD_PW_EXPIRE
|
#ifdef HAVE_STRUCT_PASSWD_PW_EXPIRE
|
||||||
TIMET2NUM(pwd->pw_expire),
|
PW_EXPIRE2VAL(pwd->pw_expire),
|
||||||
#endif
|
#endif
|
||||||
0 /*dummy*/
|
0 /*dummy*/
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user