summaryrefslogtreecommitdiff
path: root/reentr.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2003-01-16 20:48:10 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2003-01-16 20:48:10 +0000
commit0de8cad8cba777e31f98ef8b8ac579070f7c78a6 (patch)
tree4033edd272152aff5998dcd557a1adaa6ab2d543 /reentr.c
parent13ef5feb3a8e2368992adc7df8455949512b60b3 (diff)
downloadperl-0de8cad8cba777e31f98ef8b8ac579070f7c78a6.tar.gz
Integrate changes #18422 and #18423 from maint-5.8.
18422 : Third Degree found a read of uninit memory (after setting grent_size with sysconf(), pwent_size was read). Also make the ERANGE/INVARG more consistent. 18423 : spent_size was still off. (As far as I can tell _SC_GETPW_R_SIZE_MAX is supposed to be used also for spents, not just pwents.) p4raw-link: @18422 on //depot/maint-5.8/perl: c45c44aa17d6498a967957363477eb572b803726 p4raw-id: //depot/perl@18498 p4raw-integrated: from //depot/maint-5.8/perl@18497 'copy in' reentr.h (@17645..) reentr.c reentr.pl (@18422..)
Diffstat (limited to 'reentr.c')
-rw-r--r--reentr.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/reentr.c b/reentr.c
index 35a1e91a74..052af90336 100644
--- a/reentr.c
+++ b/reentr.c
@@ -35,10 +35,10 @@ Perl_reentrant_size(pTHX) {
#ifdef HAS_DRAND48_R
#endif /* HAS_DRAND48_R */
#ifdef HAS_GETGRNAM_R
-# if defined(HAS_SYSCONF) && defined(_SC_GETPW_R_SIZE_MAX) && !defined(__GLIBC__)
- PL_reentrant_buffer->_grent_size = sysconf(_SC_GETPW_R_SIZE_MAX);
- if (PL_reentrant_buffer->_pwent_size == -1)
- PL_reentrant_buffer->_pwent_size = REENTRANTUSUALSIZE;
+# if defined(HAS_SYSCONF) && defined(_SC_GETGR_R_SIZE_MAX) && !defined(__GLIBC__)
+ PL_reentrant_buffer->_grent_size = sysconf(_SC_GETGR_R_SIZE_MAX);
+ if (PL_reentrant_buffer->_grent_size == -1)
+ PL_reentrant_buffer->_grent_size = REENTRANTUSUALSIZE;
# else
# if defined(__osf__) && defined(__alpha) && defined(SIABUFSIZ)
PL_reentrant_buffer->_grent_size = SIABUFSIZ;
@@ -94,8 +94,8 @@ Perl_reentrant_size(pTHX) {
#ifdef HAS_GETSPNAM_R
# if defined(HAS_SYSCONF) && defined(_SC_GETPW_R_SIZE_MAX) && !defined(__GLIBC__)
PL_reentrant_buffer->_spent_size = sysconf(_SC_GETPW_R_SIZE_MAX);
- if (PL_reentrant_buffer->_pwent_size == -1)
- PL_reentrant_buffer->_pwent_size = REENTRANTUSUALSIZE;
+ if (PL_reentrant_buffer->_spent_size == -1)
+ PL_reentrant_buffer->_spent_size = REENTRANTUSUALSIZE;
# else
# if defined(__osf__) && defined(__alpha) && defined(SIABUFSIZ)
PL_reentrant_buffer->_spent_size = SIABUFSIZ;
@@ -342,10 +342,10 @@ Perl_reentrant_retry(const char *f, ...)
case OP_GHOSTENT:
retptr = gethostent(); break;
default:
+ SETERRNO(ERANGE, LIB_INVARG);
break;
}
}
- SETERRNO(ERANGE, LIB_INVARG);
}
break;
#endif
@@ -373,10 +373,10 @@ Perl_reentrant_retry(const char *f, ...)
case OP_GGRENT:
retptr = getgrent(); break;
default:
+ SETERRNO(ERANGE, LIB_INVARG);
break;
}
}
- SETERRNO(ERANGE, LIB_INVARG);
}
break;
#endif
@@ -405,10 +405,10 @@ Perl_reentrant_retry(const char *f, ...)
case OP_GNETENT:
retptr = getnetent(); break;
default:
+ SETERRNO(ERANGE, LIB_INVARG);
break;
}
}
- SETERRNO(ERANGE, LIB_INVARG);
}
break;
#endif
@@ -436,6 +436,7 @@ Perl_reentrant_retry(const char *f, ...)
case OP_GPWENT:
retptr = getpwent(); break;
default:
+ SETERRNO(ERANGE, LIB_INVARG);
break;
}
}
@@ -465,10 +466,10 @@ Perl_reentrant_retry(const char *f, ...)
case OP_GPROTOENT:
retptr = getprotoent(); break;
default:
+ SETERRNO(ERANGE, LIB_INVARG);
break;
}
}
- SETERRNO(ERANGE, LIB_INVARG);
}
break;
#endif
@@ -497,10 +498,10 @@ Perl_reentrant_retry(const char *f, ...)
case OP_GSERVENT:
retptr = getservent(); break;
default:
+ SETERRNO(ERANGE, LIB_INVARG);
break;
}
}
- SETERRNO(ERANGE, LIB_INVARG);
}
break;
#endif