httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dietz, Phil E." <PEDi...@west.com>
Subject ap_hook_error_log hook segfault
Date Wed, 08 Jan 2003 16:21:08 GMT
Can someone explain why the below seg-faults ?

I'm writing a module using the error log hook, and for initial testing, am using ap_log_error.
I'd assume this should double log everything.


#include "apr_want.h"

#include "ap_config.h"     
#include "mod_log_config.h"
#include "httpd.h"
#include "http_config.h"        
#include "http_core.h"          /* For REMOTE_NAME */
#include "http_log.h"
#include "apr_optional.h"
#include "http_protocol.h"
#include "util_time.h"

module AP_MODULE_DECLARE_DATA myrerror_module;

/*************************************************************
 * replacement for ap_log_rerror                             *
 *************************************************************/
void
myrerror(const char *file, int line, int level, apr_status_t status, const server_rec *s,
const request_rec *r, apr_pool_t *pool, const char *fmt)
{
        /* It core dumps on ap_log_error()...putting a return; here stops it from dumping.
*/
        if (s) ap_log_error(file, line, level, status, s, fmt);
        return;
}       /* myrerror */

static void register_hooks(apr_pool_t *p)
{
    ap_hook_error_log(myrerror,NULL,NULL,APR_HOOK_MIDDLE);
};

/**************************************************************
 * Module Defininition                                        *
 **************************************************************/
module AP_MODULE_DECLARE_DATA myrerror_module = {
    STANDARD20_MODULE_STUFF,
    NULL,           /* dir config creater */
    NULL,           /* dir merger --- default is to override */
    NULL,           /* server config */
    NULL,           /* merge server configs */
    NULL,           /* command apr_table_t */
    register_hooks  /* register hooks */
};


Mime
View raw message