process.c: GETPW_R_SIZE_INIT, GETGR_R_SIZE_INIT
* process.c (GETPW_R_SIZE_INIT, GETGR_R_SIZE_INIT): sysconf values are not maximum sizes, but initial sizes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b1fb57da3d
commit
9e33b72ad1
12
process.c
12
process.c
@ -151,6 +151,8 @@ static void check_gid_switch(void);
|
|||||||
#if defined(HAVE_PWD_H)
|
#if defined(HAVE_PWD_H)
|
||||||
# if defined(HAVE_GETPWNAM_R) && defined(_SC_GETPW_R_SIZE_MAX)
|
# if defined(HAVE_GETPWNAM_R) && defined(_SC_GETPW_R_SIZE_MAX)
|
||||||
# define USE_GETPWNAM_R 1
|
# define USE_GETPWNAM_R 1
|
||||||
|
# define GETPW_R_SIZE_INIT sysconf(_SC_GETPW_R_SIZE_MAX)
|
||||||
|
# define GETPW_R_SIZE_DEFAULT 0x1000
|
||||||
# endif
|
# endif
|
||||||
# ifdef USE_GETPWNAM_R
|
# ifdef USE_GETPWNAM_R
|
||||||
# define PREPARE_GETPWNAM \
|
# define PREPARE_GETPWNAM \
|
||||||
@ -188,6 +190,8 @@ static rb_uid_t obj2uid(VALUE id);
|
|||||||
#if defined(HAVE_GRP_H)
|
#if defined(HAVE_GRP_H)
|
||||||
# if defined(HAVE_GETGRNAM_R) && defined(_SC_GETGR_R_SIZE_MAX)
|
# if defined(HAVE_GETGRNAM_R) && defined(_SC_GETGR_R_SIZE_MAX)
|
||||||
# define USE_GETGRNAM_R
|
# define USE_GETGRNAM_R
|
||||||
|
# define GETGR_R_SIZE_INIT sysconf(_SC_GETGR_R_SIZE_MAX)
|
||||||
|
# define GETGR_R_SIZE_DEFAULT 0x1000
|
||||||
# endif
|
# endif
|
||||||
# ifdef USE_GETGRNAM_R
|
# ifdef USE_GETGRNAM_R
|
||||||
# define PREPARE_GETGRNAM \
|
# define PREPARE_GETGRNAM \
|
||||||
@ -4729,8 +4733,8 @@ obj2uid(VALUE id
|
|||||||
char *getpw_buf;
|
char *getpw_buf;
|
||||||
long getpw_buf_len;
|
long getpw_buf_len;
|
||||||
if (!*getpw_tmp) {
|
if (!*getpw_tmp) {
|
||||||
getpw_buf_len = sysconf(_SC_GETPW_R_SIZE_MAX);
|
getpw_buf_len = GETPW_R_SIZE_INIT;
|
||||||
if (getpw_buf_len < 0) getpw_buf_len = 4096;
|
if (getpw_buf_len < 0) getpw_buf_len = GETPW_R_SIZE_DEFAULT;
|
||||||
getpw_buf = rb_alloc_tmp_buffer(getpw_tmp, getpw_buf_len);
|
getpw_buf = rb_alloc_tmp_buffer(getpw_tmp, getpw_buf_len);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -4797,8 +4801,8 @@ obj2gid(VALUE id
|
|||||||
char *getgr_buf;
|
char *getgr_buf;
|
||||||
long getgr_buf_len;
|
long getgr_buf_len;
|
||||||
if (!*getgr_tmp) {
|
if (!*getgr_tmp) {
|
||||||
getgr_buf_len = sysconf(_SC_GETGR_R_SIZE_MAX);
|
getgr_buf_len = GETGR_R_SIZE_INIT;
|
||||||
if (getgr_buf_len < 0) getgr_buf_len = 4096;
|
if (getgr_buf_len < 0) getgr_buf_len = GETGR_R_SIZE_DEFAULT;
|
||||||
getgr_buf = rb_alloc_tmp_buffer(getgr_tmp, getgr_buf_len);
|
getgr_buf = rb_alloc_tmp_buffer(getgr_tmp, getgr_buf_len);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user