|
|
3ef932 |
# ./pullrev.sh 1891269 1891198 1891196
|
|
|
3ef932 |
http://svn.apache.org/viewvc?view=revision&revision=1891269
|
|
|
3ef932 |
http://svn.apache.org/viewvc?view=revision&revision=1891198
|
|
|
3ef932 |
http://svn.apache.org/viewvc?view=revision&revision=1891196
|
|
|
3ef932 |
|
|
|
3ef932 |
--- apr-1.7.0/include/arch/unix/apr_arch_thread_mutex.h
|
|
|
3ef932 |
+++ apr-1.7.0/include/arch/unix/apr_arch_thread_mutex.h
|
|
|
3ef932 |
@@ -33,8 +33,10 @@
|
|
|
3ef932 |
struct apr_thread_mutex_t {
|
|
|
3ef932 |
apr_pool_t *pool;
|
|
|
3ef932 |
pthread_mutex_t mutex;
|
|
|
3ef932 |
+#ifndef HAVE_PTHREAD_MUTEX_TIMEDLOCK
|
|
|
3ef932 |
apr_thread_cond_t *cond;
|
|
|
3ef932 |
int locked, num_waiters;
|
|
|
3ef932 |
+#endif
|
|
|
3ef932 |
};
|
|
|
3ef932 |
#endif
|
|
|
3ef932 |
|
|
|
3ef932 |
--- apr-1.7.0/locks/unix/thread_mutex.c
|
|
|
3ef932 |
+++ apr-1.7.0/locks/unix/thread_mutex.c
|
|
|
3ef932 |
@@ -102,6 +102,7 @@
|
|
|
3ef932 |
{
|
|
|
3ef932 |
apr_status_t rv;
|
|
|
3ef932 |
|
|
|
3ef932 |
+#ifndef HAVE_PTHREAD_MUTEX_TIMEDLOCK
|
|
|
3ef932 |
if (mutex->cond) {
|
|
|
3ef932 |
apr_status_t rv2;
|
|
|
3ef932 |
|
|
|
3ef932 |
@@ -133,6 +134,7 @@
|
|
|
3ef932 |
|
|
|
3ef932 |
return rv;
|
|
|
3ef932 |
}
|
|
|
3ef932 |
+#endif
|
|
|
3ef932 |
|
|
|
3ef932 |
rv = pthread_mutex_lock(&mutex->mutex);
|
|
|
3ef932 |
#ifdef HAVE_ZOS_PTHREADS
|
|
|
3ef932 |
@@ -148,6 +150,7 @@
|
|
|
3ef932 |
{
|
|
|
3ef932 |
apr_status_t rv;
|
|
|
3ef932 |
|
|
|
3ef932 |
+#ifndef HAVE_PTHREAD_MUTEX_TIMEDLOCK
|
|
|
3ef932 |
if (mutex->cond) {
|
|
|
3ef932 |
apr_status_t rv2;
|
|
|
3ef932 |
|
|
|
3ef932 |
@@ -177,6 +180,7 @@
|
|
|
3ef932 |
|
|
|
3ef932 |
return rv;
|
|
|
3ef932 |
}
|
|
|
3ef932 |
+#endif
|
|
|
3ef932 |
|
|
|
3ef932 |
rv = pthread_mutex_trylock(&mutex->mutex);
|
|
|
3ef932 |
if (rv) {
|
|
|
3ef932 |
@@ -281,6 +285,7 @@
|
|
|
3ef932 |
{
|
|
|
3ef932 |
apr_status_t status;
|
|
|
3ef932 |
|
|
|
3ef932 |
+#ifndef HAVE_PTHREAD_MUTEX_TIMEDLOCK
|
|
|
3ef932 |
if (mutex->cond) {
|
|
|
3ef932 |
status = pthread_mutex_lock(&mutex->mutex);
|
|
|
3ef932 |
if (status) {
|
|
|
3ef932 |
@@ -303,6 +308,7 @@
|
|
|
3ef932 |
|
|
|
3ef932 |
mutex->locked = 0;
|
|
|
3ef932 |
}
|
|
|
3ef932 |
+#endif
|
|
|
3ef932 |
|
|
|
3ef932 |
status = pthread_mutex_unlock(&mutex->mutex);
|
|
|
3ef932 |
#ifdef HAVE_ZOS_PTHREADS
|
|
|
3ef932 |
@@ -318,9 +324,12 @@
|
|
|
3ef932 |
{
|
|
|
3ef932 |
apr_status_t rv, rv2 = APR_SUCCESS;
|
|
|
3ef932 |
|
|
|
3ef932 |
+#ifndef HAVE_PTHREAD_MUTEX_TIMEDLOCK
|
|
|
3ef932 |
if (mutex->cond) {
|
|
|
3ef932 |
rv2 = apr_thread_cond_destroy(mutex->cond);
|
|
|
3ef932 |
}
|
|
|
3ef932 |
+#endif
|
|
|
3ef932 |
+
|
|
|
3ef932 |
rv = apr_pool_cleanup_run(mutex->pool, mutex, thread_mutex_cleanup);
|
|
|
3ef932 |
if (rv == APR_SUCCESS) {
|
|
|
3ef932 |
rv = rv2;
|
|
|
3ef932 |
--- apr-1.7.0/random/unix/sha2.c
|
|
|
3ef932 |
+++ apr-1.7.0/random/unix/sha2.c
|
|
|
3ef932 |
@@ -425,7 +425,7 @@
|
|
|
3ef932 |
usedspace = freespace = 0;
|
|
|
3ef932 |
}
|
|
|
3ef932 |
|
|
|
3ef932 |
-void apr__SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
|
|
|
3ef932 |
+void apr__SHA256_Final(sha2_byte digest[SHA256_DIGEST_LENGTH], SHA256_CTX* context) {
|
|
|
3ef932 |
sha2_word32 *d = (sha2_word32*)digest;
|
|
|
3ef932 |
unsigned int usedspace;
|
|
|
3ef932 |
|
|
|
3ef932 |
@@ -496,7 +496,7 @@
|
|
|
3ef932 |
usedspace = 0;
|
|
|
3ef932 |
}
|
|
|
3ef932 |
|
|
|
3ef932 |
-char *apr__SHA256_End(SHA256_CTX* context, char buffer[]) {
|
|
|
3ef932 |
+char *apr__SHA256_End(SHA256_CTX* context, char buffer[SHA256_DIGEST_STRING_LENGTH]) {
|
|
|
3ef932 |
sha2_byte digest[SHA256_DIGEST_LENGTH], *d = digest;
|
|
|
3ef932 |
int i;
|
|
|
3ef932 |
|
|
|
3ef932 |
--- apr-1.7.0/time/unix/time.c
|
|
|
3ef932 |
+++ apr-1.7.0/time/unix/time.c
|
|
|
3ef932 |
@@ -142,6 +142,9 @@
|
|
|
3ef932 |
static const int dayoffset[12] =
|
|
|
3ef932 |
{306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275};
|
|
|
3ef932 |
|
|
|
3ef932 |
+ if (xt->tm_mon < 0 || xt->tm_mon >= 12)
|
|
|
3ef932 |
+ return APR_EBADDATE;
|
|
|
3ef932 |
+
|
|
|
3ef932 |
/* shift new year to 1st March in order to make leap year calc easy */
|
|
|
3ef932 |
|
|
|
3ef932 |
if (xt->tm_mon < 2)
|
|
|
3ef932 |
--- apr-1.7.0/time/win32/time.c
|
|
|
3ef932 |
+++ apr-1.7.0/time/win32/time.c
|
|
|
3ef932 |
@@ -54,6 +54,9 @@
|
|
|
3ef932 |
static const int dayoffset[12] =
|
|
|
3ef932 |
{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
|
|
|
3ef932 |
|
|
|
3ef932 |
+ if (tm->wMonth < 1 || tm->wMonth > 12)
|
|
|
3ef932 |
+ return APR_EBADDATE;
|
|
|
3ef932 |
+
|
|
|
3ef932 |
/* Note; the caller is responsible for filling in detailed tm_usec,
|
|
|
3ef932 |
* tm_gmtoff and tm_isdst data when applicable.
|
|
|
3ef932 |
*/
|
|
|
3ef932 |
@@ -228,6 +231,9 @@
|
|
|
3ef932 |
static const int dayoffset[12] =
|
|
|
3ef932 |
{306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275};
|
|
|
3ef932 |
|
|
|
3ef932 |
+ if (xt->tm_mon < 0 || xt->tm_mon >= 12)
|
|
|
3ef932 |
+ return APR_EBADDATE;
|
|
|
3ef932 |
+
|
|
|
3ef932 |
/* shift new year to 1st March in order to make leap year calc easy */
|
|
|
3ef932 |
|
|
|
3ef932 |
if (xt->tm_mon < 2)
|
|
|
3ef932 |
--- apr-1.7.0/file_io/unix/readwrite.c
|
|
|
3ef932 |
+++ apr-1.7.0/file_io/unix/readwrite.c
|
|
|
3ef932 |
@@ -146,7 +146,7 @@
|
|
|
3ef932 |
|
|
|
3ef932 |
APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, apr_size_t *nbytes)
|
|
|
3ef932 |
{
|
|
|
3ef932 |
- apr_size_t rv;
|
|
|
3ef932 |
+ apr_size_t rv = APR_SUCCESS;
|
|
|
3ef932 |
|
|
|
3ef932 |
if (thefile->buffered) {
|
|
|
3ef932 |
char *pos = (char *)buf;
|
|
|
3ef932 |
@@ -160,13 +160,14 @@
|
|
|
3ef932 |
* logically reading from
|
|
|
3ef932 |
*/
|
|
|
3ef932 |
apr_int64_t offset = thefile->filePtr - thefile->dataRead + thefile->bufpos;
|
|
|
3ef932 |
- if (offset != thefile->filePtr)
|
|
|
3ef932 |
- lseek(thefile->filedes, offset, SEEK_SET);
|
|
|
3ef932 |
+ if (offset != thefile->filePtr) {
|
|
|
3ef932 |
+ thefile->filePtr = lseek(thefile->filedes, offset, SEEK_SET);
|
|
|
3ef932 |
+ if (thefile->filePtr == -1) rv = errno;
|
|
|
3ef932 |
+ }
|
|
|
3ef932 |
thefile->bufpos = thefile->dataRead = 0;
|
|
|
3ef932 |
thefile->direction = 1;
|
|
|
3ef932 |
}
|
|
|
3ef932 |
|
|
|
3ef932 |
- rv = 0;
|
|
|
3ef932 |
while (rv == 0 && size > 0) {
|
|
|
3ef932 |
if (thefile->bufpos == thefile->bufsize) /* write buffer is full*/
|
|
|
3ef932 |
rv = apr_file_flush_locked(thefile);
|
|
|
3ef932 |
@@ -244,12 +245,15 @@
|
|
|
3ef932 |
*/
|
|
|
3ef932 |
apr_int64_t offset = thefile->filePtr - thefile->dataRead +
|
|
|
3ef932 |
thefile->bufpos;
|
|
|
3ef932 |
- if (offset != thefile->filePtr)
|
|
|
3ef932 |
- lseek(thefile->filedes, offset, SEEK_SET);
|
|
|
3ef932 |
+ if (offset != thefile->filePtr) {
|
|
|
3ef932 |
+ thefile->filePtr = lseek(thefile->filedes, offset, SEEK_SET);
|
|
|
3ef932 |
+ if (thefile->filePtr == -1) rv = errno;
|
|
|
3ef932 |
+ }
|
|
|
3ef932 |
thefile->bufpos = thefile->dataRead = 0;
|
|
|
3ef932 |
}
|
|
|
3ef932 |
|
|
|
3ef932 |
file_unlock(thefile);
|
|
|
3ef932 |
+ if (rv) return rv;
|
|
|
3ef932 |
}
|
|
|
3ef932 |
|
|
|
3ef932 |
if ((bytes = writev(thefile->filedes, vec, nvec)) < 0) {
|
|
|
3ef932 |
--- apr-1.7.0/locks/unix/proc_mutex.c
|
|
|
3ef932 |
+++ apr-1.7.0/locks/unix/proc_mutex.c
|
|
|
3ef932 |
@@ -1518,11 +1518,10 @@
|
|
|
3ef932 |
|
|
|
3ef932 |
APR_DECLARE(const char *) apr_proc_mutex_defname(void)
|
|
|
3ef932 |
{
|
|
|
3ef932 |
- apr_status_t rv;
|
|
|
3ef932 |
apr_proc_mutex_t mutex;
|
|
|
3ef932 |
|
|
|
3ef932 |
- if ((rv = proc_mutex_choose_method(&mutex, APR_LOCK_DEFAULT,
|
|
|
3ef932 |
- NULL)) != APR_SUCCESS) {
|
|
|
3ef932 |
+ if (proc_mutex_choose_method(&mutex, APR_LOCK_DEFAULT,
|
|
|
3ef932 |
+ NULL) != APR_SUCCESS) {
|
|
|
3ef932 |
return "unknown";
|
|
|
3ef932 |
}
|
|
|
3ef932 |
|
|
|
3ef932 |
--- apr-1.7.0/memory/unix/apr_pools.c
|
|
|
3ef932 |
+++ apr-1.7.0/memory/unix/apr_pools.c
|
|
|
3ef932 |
@@ -1338,7 +1338,7 @@
|
|
|
3ef932 |
apr_size_t free_index;
|
|
|
3ef932 |
|
|
|
3ef932 |
pool_concurrency_set_used(pool);
|
|
|
3ef932 |
- ps.node = active = pool->active;
|
|
|
3ef932 |
+ ps.node = pool->active;
|
|
|
3ef932 |
ps.pool = pool;
|
|
|
3ef932 |
ps.vbuff.curpos = ps.node->first_avail;
|
|
|
3ef932 |
|
|
|
3ef932 |
--- apr-1.7.0/test/teststr.c
|
|
|
3ef932 |
+++ apr-1.7.0/test/teststr.c
|
|
|
3ef932 |
@@ -394,6 +394,19 @@
|
|
|
3ef932 |
ABTS_STR_EQUAL(tc, apr_cstr_skip_prefix("", "12"), NULL);
|
|
|
3ef932 |
}
|
|
|
3ef932 |
|
|
|
3ef932 |
+static void pstrcat(abts_case *tc, void *data)
|
|
|
3ef932 |
+{
|
|
|
3ef932 |
+ ABTS_STR_EQUAL(tc, apr_pstrcat(p, "a", "bc", "def", NULL),
|
|
|
3ef932 |
+ "abcdef");
|
|
|
3ef932 |
+ ABTS_STR_EQUAL(tc, apr_pstrcat(p, NULL), "");
|
|
|
3ef932 |
+ ABTS_STR_EQUAL(tc, apr_pstrcat(p,
|
|
|
3ef932 |
+ "a", "b", "c", "d", "e",
|
|
|
3ef932 |
+ "f", "g", "h", "i", "j",
|
|
|
3ef932 |
+ "1", "2", "3", "4", "5",
|
|
|
3ef932 |
+ NULL),
|
|
|
3ef932 |
+ "abcdefghij12345");
|
|
|
3ef932 |
+}
|
|
|
3ef932 |
+
|
|
|
3ef932 |
abts_suite *teststr(abts_suite *suite)
|
|
|
3ef932 |
{
|
|
|
3ef932 |
suite = ADD_SUITE(suite)
|
|
|
3ef932 |
@@ -412,6 +425,7 @@
|
|
|
3ef932 |
abts_run_test(suite, string_cpystrn, NULL);
|
|
|
3ef932 |
abts_run_test(suite, snprintf_overflow, NULL);
|
|
|
3ef932 |
abts_run_test(suite, skip_prefix, NULL);
|
|
|
3ef932 |
+ abts_run_test(suite, pstrcat, NULL);
|
|
|
3ef932 |
|
|
|
3ef932 |
return suite;
|
|
|
3ef932 |
}
|