You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rj...@apache.org on 2013/10/03 20:52:56 UTC
svn commit: r1528969 - in /httpd/httpd/branches/2.4.x: ./ STATUS
modules/cache/mod_cache_socache.c modules/cache/mod_socache_shmcb.c
modules/filters/mod_deflate.c modules/ssl/mod_ssl.c
server/mpm/winnt/child.c support/rotatelogs.c
Author: rjung
Date: Thu Oct 3 18:52:55 2013
New Revision: 1528969
URL: http://svn.apache.org/r1528969
Log:
Multiple backports from trunk:
- rotatelog: Factor out from doRotate, main; make error handling consistant
and print the actual error to stderr
PR 45084
Backport of r1374247 from trunk.
- rotatelog: Cleanups, no functional change. Drop revision history,
"svn log" works; use APR_PATH_MAX; constify more
Backport of r1409800 from trunk.
- rotatelog: error[120] is already defined in this function. Just use
it instead of shadowing.
Backport of r1416121 from trunk.
- rotatelog: Use apr_snprintf(... "%pm"...) instead of explicit call
to apr_strerror
Backport of r1463736 from trunk.
- mod_deflate: style fix (no code change)
Backport of r1499679 from trunk.
- mod_socache_shmcb: Correct the use of the printf formatter.
Backport of r1493925 from trunk.
- mod_cache_socache: Fixed signed<->unsigned compiler warning.
Backport of r1490550 from trunk.
- mod_ssl: add missing space between directive description and syntax
Backport of r1509983 from trunk.
- mpm/winnt: style consistency in winnt's worker_main
Backport of r1520760 from trunk.
Proposed by: jailletc36
Reviewed by: jim, rjung
Modified:
httpd/httpd/branches/2.4.x/ (props changed)
httpd/httpd/branches/2.4.x/STATUS
httpd/httpd/branches/2.4.x/modules/cache/mod_cache_socache.c
httpd/httpd/branches/2.4.x/modules/cache/mod_socache_shmcb.c
httpd/httpd/branches/2.4.x/modules/filters/mod_deflate.c
httpd/httpd/branches/2.4.x/modules/ssl/mod_ssl.c
httpd/httpd/branches/2.4.x/server/mpm/winnt/child.c
httpd/httpd/branches/2.4.x/support/rotatelogs.c
Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
Merged /httpd/httpd/trunk:r1374247,1409800,1416121,1463736,1490550,1493925,1499679,1509983,1520760
Modified: httpd/httpd/branches/2.4.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/STATUS?rev=1528969&r1=1528968&r2=1528969&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/STATUS (original)
+++ httpd/httpd/branches/2.4.x/STATUS Thu Oct 3 18:52:55 2013
@@ -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
Modified: httpd/httpd/branches/2.4.x/modules/cache/mod_cache_socache.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/cache/mod_cache_socache.c?rev=1528969&r1=1528968&r2=1528969&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/cache/mod_cache_socache.c (original)
+++ httpd/httpd/branches/2.4.x/modules/cache/mod_cache_socache.c Thu Oct 3 18:52:55 2013
@@ -168,8 +168,8 @@ static apr_status_t store_array(apr_arra
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,
Modified: httpd/httpd/branches/2.4.x/modules/cache/mod_socache_shmcb.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/cache/mod_socache_shmcb.c?rev=1528969&r1=1528968&r2=1528969&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/cache/mod_socache_shmcb.c (original)
+++ httpd/httpd/branches/2.4.x/modules/cache/mod_socache_shmcb.c Thu Oct 3 18:52:55 2013
@@ -316,11 +316,9 @@ static const char *socache_shmcb_create(
}
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 == ')') {
Modified: httpd/httpd/branches/2.4.x/modules/filters/mod_deflate.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/filters/mod_deflate.c?rev=1528969&r1=1528968&r2=1528969&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/filters/mod_deflate.c (original)
+++ httpd/httpd/branches/2.4.x/modules/filters/mod_deflate.c Thu Oct 3 18:52:55 2013
@@ -1013,8 +1013,8 @@ static apr_status_t deflate_in_filter(ap
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
/* 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;
}
Modified: httpd/httpd/branches/2.4.x/modules/ssl/mod_ssl.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/ssl/mod_ssl.c?rev=1528969&r1=1528968&r2=1528969&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/ssl/mod_ssl.c (original)
+++ httpd/httpd/branches/2.4.x/modules/ssl/mod_ssl.c Thu Oct 3 18:52:55 2013
@@ -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")
Modified: httpd/httpd/branches/2.4.x/server/mpm/winnt/child.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/server/mpm/winnt/child.c?rev=1528969&r1=1528968&r2=1528969&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/server/mpm/winnt/child.c (original)
+++ httpd/httpd/branches/2.4.x/server/mpm/winnt/child.c Thu Oct 3 18:52:55 2013
@@ -809,12 +809,12 @@ static DWORD __stdcall worker_main(void
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
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,
Modified: httpd/httpd/branches/2.4.x/support/rotatelogs.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/support/rotatelogs.c?rev=1528969&r1=1528968&r2=1528969&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/support/rotatelogs.c (original)
+++ httpd/httpd/branches/2.4.x/support/rotatelogs.c Thu Oct 3 18:52:55 2013
@@ -14,31 +14,6 @@
* limitations under the License.
*/
-/*
- * Simple program to rotate Apache logs without having to kill the server.
- *
- * Contributed by Ben Laurie <ben algroup.co.uk>
- *
- * 12 Mar 1996
- *
- * Ported to APR by Mladen Turk <mturk mappingsoft.com>
- *
- * 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_stat
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
}
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
}
}
+/* 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 *co
}
else {
char error[120];
- apr_size_t nWrite;
apr_strerror(rv, error, sizeof error);
@@ -468,16 +455,8 @@ static void doRotate(rotate_config_t *co
"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 a
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++;