mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ec70309ffa
commit
8f9a46a304
1 changed files with 12 additions and 2 deletions
14
process.c
14
process.c
|
@ -173,6 +173,11 @@ static void check_gid_switch(void);
|
|||
VALUE getpw_buf = 0
|
||||
# define FINISH_GETPWNAM \
|
||||
(getpw_buf ? (void)rb_str_resize(getpw_buf, 0) : (void)0)
|
||||
# ifdef __APPLE__
|
||||
# define GETPWNAM_R_RETRY_P(e) (e == 0 || e == ERANGE)
|
||||
# else
|
||||
# define GETPWNAM_R_RETRY_P(e) (e == ERANGE)
|
||||
# endif
|
||||
# define OBJ2UID1(id) obj2uid((id), &getpw_buf)
|
||||
# define OBJ2UID(id) obj2uid0(id)
|
||||
static rb_uid_t obj2uid(VALUE id, VALUE *getpw_buf);
|
||||
|
@ -215,6 +220,11 @@ static rb_uid_t obj2uid(VALUE id);
|
|||
VALUE getgr_buf = 0
|
||||
# define FINISH_GETGRNAM \
|
||||
(getgr_buf ? (void)rb_str_resize(getgr_buf, 0) : (void)0)
|
||||
# ifdef __APPLE__
|
||||
# define GETGRNAM_R_RETRY_P(e) (e == 0 || e == ERANGE)
|
||||
# else
|
||||
# define GETGRNAM_R_RETRY_P(e) (e == ERANGE)
|
||||
# endif
|
||||
# define OBJ2GID1(id) obj2gid((id), &getgr_buf)
|
||||
# define OBJ2GID(id) obj2gid0(id)
|
||||
static rb_gid_t obj2gid(VALUE id, VALUE *getgr_buf);
|
||||
|
@ -5042,7 +5052,7 @@ obj2uid(VALUE id
|
|||
/* gepwnam_r() on MacOS X doesn't set errno if buffer size is insufficient */
|
||||
while (getpwnam_r(usrname, &pwbuf, getpw_buf, getpw_buf_len, &pwptr)) {
|
||||
int e = errno;
|
||||
if (e != ERANGE || getpw_buf_len >= GETPW_R_SIZE_LIMIT) {
|
||||
if (!GETPWNAM_R_RETRY_P(e) || getpw_buf_len >= GETPW_R_SIZE_LIMIT) {
|
||||
rb_str_resize(*getpw_tmp, 0);
|
||||
rb_syserr_fail(e, "getpwnam_r");
|
||||
}
|
||||
|
@ -5120,7 +5130,7 @@ obj2gid(VALUE id
|
|||
/* gegrnam_r() on MacOS X doesn't set errno if buffer size is insufficient */
|
||||
while (getgrnam_r(grpname, &grbuf, getgr_buf, getgr_buf_len, &grptr)) {
|
||||
int e = errno;
|
||||
if (e != ERANGE || getgr_buf_len >= GETGR_R_SIZE_LIMIT) {
|
||||
if (!GETGRNAM_R_RETRY_P(e) || getgr_buf_len >= GETGR_R_SIZE_LIMIT) {
|
||||
rb_str_resize(*getgr_tmp, 0);
|
||||
rb_syserr_fail(e, "getgrnam_r");
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue