diff --git a/STATUS b/STATUS index 24109e4608..4b9a625667 100644 --- a/STATUS +++ b/STATUS @@ -97,33 +97,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - * easy patches to synch 2.4 and trunk - - rotatelog: Factor out from doRotate, main; make error handling consistant - and print the actual error to stderr - PR 45084 - - rotatelog: Cleanups, no functional change. Drop revision history, - "svn log" works; use APR_PATH_MAX; constify more - - rotatelog: error[120] is already defined in this function. Just use - it instead of shadowing. - - rotatelog: Use apr_snprintf(... "%pm"...) instead of explicit call - to apr_strerror - - mod_deflate: style fix (no code change) - - mod_socache_shmcb: Correct the use of the printf formatter. - - mod_cache_socache: Fixed signed<->unsigned compiler warning. - - mod_ssl: add missing space between directive description and syntax - - mpm/winnt: style consistency in winnt's worker_main - trunk: http://svn.apache.org/viewvc?view=revision&revision=1374247 - http://svn.apache.org/viewvc?view=revision&revision=1409800 - http://svn.apache.org/viewvc?view=revision&revision=1416121 - http://svn.apache.org/viewvc?view=revision&revision=1463736 - http://svn.apache.org/viewvc?view=revision&revision=1499679 - http://svn.apache.org/viewvc?view=revision&revision=1493925 - http://svn.apache.org/viewvc?view=revision&revision=1490550 - http://svn.apache.org/viewvc?view=revision&revision=1509983 - http://svn.apache.org/viewvc?view=revision&revision=1520760 - 2.4.x: trunk patches work - +1: jailletc36, jim, rjung - * mod_ldap: Don't filter subgroups on cn=* trunk: http://svn.apache.org/r1528143 2.4.x: trunk works module CHANGES diff --git a/modules/cache/mod_cache_socache.c b/modules/cache/mod_cache_socache.c index 913de2ee9c..220f9c8bd0 100644 --- a/modules/cache/mod_cache_socache.c +++ b/modules/cache/mod_cache_socache.c @@ -168,8 +168,8 @@ static apr_status_t store_array(apr_array_header_t *arr, unsigned char *buffer, elts = (const char **) arr->elts; for (i = 0; i < arr->nelts; i++) { - len = strlen(elts[i]); - if (len + 3 >= buffer_len - *slider) { + apr_size_t e_len = strlen(elts[i]); + if (e_len + 3 >= buffer_len - *slider) { return APR_EOF; } len = apr_snprintf(buffer ? (char *) buffer + *slider : NULL, diff --git a/modules/cache/mod_socache_shmcb.c b/modules/cache/mod_socache_shmcb.c index 4d4246b325..f6bf1dab28 100644 --- a/modules/cache/mod_socache_shmcb.c +++ b/modules/cache/mod_socache_shmcb.c @@ -316,11 +316,9 @@ static const char *socache_shmcb_create(ap_socache_instance_t **context, } if (ctx->shm_size >= SHMCB_MAX_SIZE) { - return apr_psprintf(tmp, - "Invalid argument: size has " - "to be < %d bytes on this platform", - SHMCB_MAX_SIZE); - + return apr_psprintf(tmp, "Invalid argument: size has " + "to be < %" APR_SIZE_T_FMT " bytes on this platform", + SHMCB_MAX_SIZE); } } else if (cp2 >= path && *cp2 == ')') { diff --git a/modules/filters/mod_deflate.c b/modules/filters/mod_deflate.c index c7157cc925..5ae06085b9 100644 --- a/modules/filters/mod_deflate.c +++ b/modules/filters/mod_deflate.c @@ -1013,8 +1013,8 @@ static apr_status_t deflate_in_filter(ap_filter_t *f, if (APR_BUCKET_IS_EOS(bkt)) { if (!ctx->done) { inflateEnd(&ctx->stream); - ap_log_rerror( - APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(02481) "Encountered premature end-of-stream while inflating"); + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(02481) + "Encountered premature end-of-stream while inflating"); return APR_EGENERAL; } @@ -1053,8 +1053,8 @@ static apr_status_t deflate_in_filter(ap_filter_t *f, /* sanity check - data after completed compressed body and before eos? */ if (ctx->done) { - ap_log_rerror( - APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(02482) "Encountered extra data after compressed data"); + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(02482) + "Encountered extra data after compressed data"); return APR_EGENERAL; } diff --git a/modules/ssl/mod_ssl.c b/modules/ssl/mod_ssl.c index a43f656ef5..cc485947cb 100644 --- a/modules/ssl/mod_ssl.c +++ b/modules/ssl/mod_ssl.c @@ -139,7 +139,7 @@ static const command_rec ssl_config_cmds[] = { SSL_CMD_SRV(HonorCipherOrder, FLAG, "Use the server's cipher ordering preference") SSL_CMD_SRV(Compression, FLAG, - "Enable SSL level compression" + "Enable SSL level compression " "(`on', `off')") SSL_CMD_SRV(InsecureRenegotiation, FLAG, "Enable support for insecure renegotiation") diff --git a/server/mpm/winnt/child.c b/server/mpm/winnt/child.c index aa7f557f04..7bfe53cd3f 100644 --- a/server/mpm/winnt/child.c +++ b/server/mpm/winnt/child.c @@ -809,12 +809,12 @@ static DWORD __stdcall worker_main(void *thread_num_val) context->sock, thread_num, sbh, context->ba); - if (!c) - { + if (!c) { /* ap_run_create_connection closes the socket on failure */ context->accept_socket = INVALID_SOCKET; - if (e) + if (e) { apr_bucket_free(e); + } continue; } @@ -832,17 +832,14 @@ static DWORD __stdcall worker_main(void *thread_num_val) c->aborted = 1; } - if (e && c->aborted) - { + if (e && c->aborted) { apr_bucket_free(e); } - else - { + else { ap_set_module_config(c->conn_config, &mpm_winnt_module, context); } - if (!c->aborted) - { + if (!c->aborted) { ap_run_process_connection(c); apr_socket_opt_get(context->sock, APR_SO_DISCONNECTED, diff --git a/support/rotatelogs.c b/support/rotatelogs.c index 3f32f3cac4..cf1eac1ea8 100644 --- a/support/rotatelogs.c +++ b/support/rotatelogs.c @@ -14,31 +14,6 @@ * limitations under the License. */ -/* - * Simple program to rotate Apache logs without having to kill the server. - * - * Contributed by Ben Laurie - * - * 12 Mar 1996 - * - * Ported to APR by Mladen Turk - * - * 23 Sep 2001 - * - * -l option added 2004-06-11 - * - * -l causes the use of local time rather than GMT as the base for the - * interval. NB: Using -l in an environment which changes the GMT offset - * (such as for BST or DST) can lead to unpredictable results! - * - * -f option added Feb, 2008. This causes rotatelog to open/create - * the logfile as soon as it's started, not as soon as it sees - * data. - * - * -v option added Feb, 2008. Verbose output of command line parsing. - */ - - #include "apr.h" #include "apr_lib.h" #include "apr_strings.h" @@ -62,17 +37,13 @@ #define BUFSIZE 65536 #define ERRMSGSZ 256 -#ifndef MAX_PATH -#define MAX_PATH 1024 -#endif - #define ROTATE_NONE 0 #define ROTATE_NEW 1 #define ROTATE_TIME 2 #define ROTATE_SIZE 3 #define ROTATE_FORCE 4 -static const char *ROTATE_REASONS[] = { +static const char *const ROTATE_REASONS[] = { "None", "Open a new file", "Time interval expired", @@ -109,7 +80,7 @@ typedef struct rotate_status rotate_status_t; struct logfile { apr_pool_t *pool; apr_file_t *fd; - char name[MAX_PATH]; + char name[APR_PATH_MAX]; }; struct rotate_status { @@ -299,7 +270,6 @@ static void post_rotate(apr_pool_t *pool, struct logfile *newlog, } rv = apr_file_link(newlog->name, config->linkfile); if (rv != APR_SUCCESS) { - char error[120]; apr_strerror(rv, error, sizeof error); fprintf(stderr, "Error linking file %s to %s (%s)\n", newlog->name, config->linkfile, error); @@ -358,6 +328,24 @@ static void post_rotate(apr_pool_t *pool, struct logfile *newlog, } } +/* After a error, truncate the current file and write out an error + * message, which must be contained in status->errbuf. The process is + * terminated on failure. */ +static void truncate_and_write_error(rotate_status_t *status) +{ + apr_size_t buflen = strlen(status->errbuf); + + if (apr_file_trunc(status->current.fd, 0) != APR_SUCCESS) { + fprintf(stderr, "Error truncating the file %s\n", status->current.name); + exit(2); + } + if (apr_file_write_full(status->current.fd, status->errbuf, buflen, NULL) != APR_SUCCESS) { + fprintf(stderr, "Error writing error (%s) to the file %s\n", + status->errbuf, status->current.name); + exit(2); + } +} + /* * Open a new log file, and if successful * also close the old one. @@ -447,7 +435,6 @@ static void doRotate(rotate_config_t *config, rotate_status_t *status) } else { char error[120]; - apr_size_t nWrite; apr_strerror(rv, error, sizeof error); @@ -468,16 +455,8 @@ static void doRotate(rotate_config_t *config, rotate_status_t *status) "Resetting log file due to error opening " "new log file, %10d messages lost: %-25.25s\n", status->nMessCount, error); - nWrite = strlen(status->errbuf); - if (apr_file_trunc(status->current.fd, 0) != APR_SUCCESS) { - fprintf(stderr, "Error truncating the file %s\n", status->current.name); - exit(2); - } - if (apr_file_write_full(status->current.fd, status->errbuf, nWrite, NULL) != APR_SUCCESS) { - fprintf(stderr, "Error writing to the file %s\n", status->current.name); - exit(2); - } + truncate_and_write_error(status); } status->nMessCount = 0; @@ -718,25 +697,19 @@ int main (int argc, const char * const argv[]) nWrite = nRead; rv = apr_file_write_full(status.current.fd, buf, nWrite, &nWrite); if (nWrite != nRead) { - char strerrbuf[120]; apr_off_t cur_offset; cur_offset = 0; if (apr_file_seek(status.current.fd, APR_CUR, &cur_offset) != APR_SUCCESS) { cur_offset = -1; } - apr_strerror(rv, strerrbuf, sizeof strerrbuf); status.nMessCount++; apr_snprintf(status.errbuf, sizeof status.errbuf, "Error %d writing to log file at offset %" APR_OFF_T_FMT ". " - "%10d messages lost (%s)\n", - rv, cur_offset, status.nMessCount, strerrbuf); - nWrite = strlen(status.errbuf); - apr_file_trunc(status.current.fd, 0); - if (apr_file_write_full(status.current.fd, status.errbuf, nWrite, NULL) != APR_SUCCESS) { - fprintf(stderr, "Error writing to the file %s\n", status.current.name); - exit(2); - } + "%10d messages lost (%pm)\n", + rv, cur_offset, status.nMessCount, &rv); + + truncate_and_write_error(&status); } else { status.nMessCount++;