You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by nd...@apache.org on 2004/04/25 19:23:31 UTC

cvs commit: httpd-2.0/server config.c core.c main.c

nd          2004/04/25 10:23:31

  Modified:    .        CHANGES
               include  ap_mmn.h http_config.h
               modules/mappers mod_so.c
               server   config.c core.c main.c
  Log:
  changed the following APIs to return an error instead of hard exiting:
  ap_add_module, ap_add_loaded_module, ap_setup_prelinked_modules,
  and ap_process_resource_config
  
  Revision  Changes    Path
  1.1472    +4 -1      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.1471
  retrieving revision 1.1472
  diff -u -u -r1.1471 -r1.1472
  --- CHANGES	25 Apr 2004 17:05:50 -0000	1.1471
  +++ CHANGES	25 Apr 2004 17:23:30 -0000	1.1472
  @@ -2,7 +2,10 @@
   
     [Remove entries to the current 2.0 section below, when backported]
   
  -  *) Removed old and unmaintained ap_add_named_module API. [Andr� Malo]
  +  *) Removed old and unmaintained ap_add_named_module API and changed
  +     the following APIs to return an error instead of hard exiting:
  +     ap_add_module, ap_add_loaded_module, ap_setup_prelinked_modules,
  +     and ap_process_resource_config.  [Andr� Malo]
   
     *) htpasswd no longer refuses to process files that contain empty
        lines.  [Andr� Malo]
  
  
  
  1.68      +2 -0      httpd-2.0/include/ap_mmn.h
  
  Index: ap_mmn.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/ap_mmn.h,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -u -r1.67 -r1.68
  --- ap_mmn.h	25 Apr 2004 17:05:51 -0000	1.67
  +++ ap_mmn.h	25 Apr 2004 17:23:31 -0000	1.68
  @@ -81,6 +81,8 @@
    * 20030821.2 (2.1.0-dev) added ap_escape_errorlog_item
    * 20030821.3 (2.1.0-dev) added ap_get_server_revision / ap_version_t
    * 20040425 (2.1.0-dev) removed ap_add_named_module API
  + *                      changed ap_add_module, ap_add_loaded_module,
  + *                      ap_setup_prelinked_modules, ap_process_resource_config
    */
   
   #define MODULE_MAGIC_COOKIE 0x41503230UL /* "AP20" */
  
  
  
  1.109     +8 -6      httpd-2.0/include/http_config.h
  
  Index: http_config.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/http_config.h,v
  retrieving revision 1.108
  retrieving revision 1.109
  diff -u -u -r1.108 -r1.109
  --- http_config.h	25 Apr 2004 17:05:51 -0000	1.108
  +++ http_config.h	25 Apr 2004 17:23:31 -0000	1.109
  @@ -543,7 +543,7 @@
    * @param m The module structure of the module to add
    * @param p The pool of the same lifetime as the module
    */
  -AP_DECLARE(void) ap_add_module(module *m, apr_pool_t *p);
  +AP_DECLARE(const char *) ap_add_module(module *m, apr_pool_t *p);
   
   /**
    * Remove a module from the server.  There are some caveats:
  @@ -559,7 +559,7 @@
    * @param m The module structure of the module to add
    * @param p The pool with the same lifetime as the module
    */
  -AP_DECLARE(void) ap_add_loaded_module(module *mod, apr_pool_t *p);
  +AP_DECLARE(const char *) ap_add_loaded_module(module *mod, apr_pool_t *p);
   /**
    * Remove a module fromthe chained modules list and the list of loaded modules
    * @param m the module structure of the module to remove
  @@ -740,7 +740,7 @@
    * Add all of the prelinked modules into the loaded module list
    * @param process The process that is currently running the server
    */
  -AP_DECLARE(void) ap_setup_prelinked_modules(process_rec *process);
  +AP_DECLARE(const char *) ap_setup_prelinked_modules(process_rec *process);
   
   /**
    * Show the preloaded configuration directives, the help string explaining
  @@ -865,9 +865,11 @@
    * @param p Pool for general allocation
    * @param ptem Pool for temporary allocation
    */
  -AP_DECLARE(void) ap_process_resource_config(server_rec *s, const char *fname, 
  -                                            ap_directive_t **conftree, 
  -                                            apr_pool_t *p, apr_pool_t *ptemp);
  +AP_DECLARE(const char *) ap_process_resource_config(server_rec *s,
  +                                                    const char *fname,
  +                                                    ap_directive_t **conftree,
  +                                                    apr_pool_t *p,
  +                                                    apr_pool_t *ptemp);
   
   /**
    * Process all directives in the config tree
  
  
  
  1.56      +5 -1      httpd-2.0/modules/mappers/mod_so.c
  
  Index: mod_so.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_so.c,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -u -r1.55 -r1.56
  --- mod_so.c	9 Feb 2004 20:29:20 -0000	1.55
  +++ mod_so.c	25 Apr 2004 17:23:31 -0000	1.56
  @@ -162,6 +162,7 @@
       moduleinfo *modi;
       moduleinfo *modie;
       int i;
  +    const char *error;
   
       /* we need to setup this value for dummy to make sure that we don't try
        * to add a non-existant tree into the build when we return to
  @@ -277,7 +278,10 @@
       /* 
        * Add this module to the Apache core structures
        */
  -    ap_add_loaded_module(modp, cmd->pool);
  +    error = ap_add_loaded_module(modp, cmd->pool);
  +    if (error) {
  +        return error;
  +    }
   
       /* 
        * Register a cleanup in the config apr_pool_t (normally pconf). When
  
  
  
  1.177     +121 -97   httpd-2.0/server/config.c
  
  Index: config.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/config.c,v
  retrieving revision 1.176
  retrieving revision 1.177
  diff -u -u -r1.176 -r1.177
  --- config.c	25 Apr 2004 17:05:51 -0000	1.176
  +++ config.c	25 Apr 2004 17:23:31 -0000	1.177
  @@ -404,7 +404,7 @@
   
   /* One-time setup for precompiled modules --- NOT to be done on restart */
   
  -AP_DECLARE(void) ap_add_module(module *m, apr_pool_t *p)
  +AP_DECLARE(const char *) ap_add_module(module *m, apr_pool_t *p)
   {
       /* This could be called from a LoadModule httpd.conf command,
        * after the file has been linked and the module structure within it
  @@ -412,14 +412,10 @@
        */
   
       if (m->version != MODULE_MAGIC_NUMBER_MAJOR) {
  -        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                     "%s: module \"%s\" is not compatible with this "
  -                     "version of Apache (found %d, need %d).",
  -                     ap_server_argv0, m->name, m->version,
  -                     MODULE_MAGIC_NUMBER_MAJOR);
  -        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                     "Please contact the vendor for the correct version.");
  -        exit(1);
  +        return apr_psprintf(p, "Module \"%s\" is not compatible with this "
  +                            "version of Apache (found %d, need %d). Please "
  +                            "contact the vendor for the correct version.",
  +                            m->name, m->version, MODULE_MAGIC_NUMBER_MAJOR);
       }
   
       if (m->next == NULL) {
  @@ -432,13 +428,10 @@
           dynamic_modules++;
   
           if (dynamic_modules > DYNAMIC_MODULE_LIMIT) {
  -            ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                         "%s: module \"%s\" could not be loaded, because"
  -                         " the dynamic", ap_server_argv0, m->name);
  -            ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                         "module limit was reached. Please increase "
  -                         "DYNAMIC_MODULE_LIMIT and recompile.");
  -            exit(1);
  +            return apr_psprintf(p, "Module \"%s\" could not be loaded, "
  +                                "because the dynamic module limit was "
  +                                "reached. Please increase "
  +                                "DYNAMIC_MODULE_LIMIT and recompile.", m->name);
           }
       }
   
  @@ -470,6 +463,8 @@
        *  It doesn't appear to be
        */
       ap_register_hooks(m, p);
  +
  +    return NULL;
   }
   
   /*
  @@ -517,14 +512,18 @@
       total_modules--;
   }
   
  -AP_DECLARE(void) ap_add_loaded_module(module *mod, apr_pool_t *p)
  +AP_DECLARE(const char *) ap_add_loaded_module(module *mod, apr_pool_t *p)
   {
       module **m;
  +    const char *error;
   
       /*
        *  Add module pointer to top of chained module list
        */
  -    ap_add_module(mod, p);
  +    error = ap_add_module(mod, p);
  +    if (error) {
  +        return error;
  +    }
   
       /*
        *  And module pointer to list of loaded modules
  @@ -538,6 +537,8 @@
           ;
       *m++ = mod;
       *m = NULL;
  +
  +    return NULL;
   }
   
   AP_DECLARE(void) ap_remove_loaded_module(module *mod)
  @@ -570,10 +571,11 @@
       *m = NULL;
   }
   
  -AP_DECLARE(void) ap_setup_prelinked_modules(process_rec *process)
  +AP_DECLARE(const char *) ap_setup_prelinked_modules(process_rec *process)
   {
       module **m;
       module **m2;
  +    const char *error;
   
       apr_hook_global_pool=process->pconf;
   
  @@ -591,8 +593,7 @@
           sizeof(module *) * (total_modules + DYNAMIC_MODULE_LIMIT + 1));
   
       if (ap_loaded_modules == NULL) {
  -        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                     "Ouch!  Out of memory in ap_setup_prelinked_modules()!");
  +        return "Ouch! Out of memory in ap_setup_prelinked_modules()!";
       }
   
       for (m = ap_preloaded_modules, m2 = ap_loaded_modules; *m != NULL; )
  @@ -603,10 +604,16 @@
       /*
        *   Initialize chain of linked (=activate) modules
        */
  -    for (m = ap_prelinked_modules; *m != NULL; m++)
  -        ap_add_module(*m, process->pconf);
  +    for (m = ap_prelinked_modules; *m != NULL; m++) {
  +        error = ap_add_module(*m, process->pconf);
  +        if (error) {
  +            return error;
  +        }
  +    }
   
       apr_hook_sort_all();
  +
  +    return NULL;
   }
   
   AP_DECLARE(const char *) ap_find_module_name(module *m)
  @@ -1359,9 +1366,11 @@
       return 0;
   }
   
  -static void process_command_config(server_rec *s, apr_array_header_t *arr,
  -                                   ap_directive_t **conftree, apr_pool_t *p,
  -                                   apr_pool_t *ptemp)
  +static const char *process_command_config(server_rec *s,
  +                                          apr_array_header_t *arr,
  +                                          ap_directive_t **conftree,
  +                                          apr_pool_t *p,
  +                                          apr_pool_t *ptemp)
   {
       const char *errmsg;
       cmd_parms parms;
  @@ -1381,14 +1390,14 @@
                                               arr_elts_getstr, arr_elts_close);
   
       errmsg = ap_build_config(&parms, p, ptemp, conftree);
  +    ap_cfg_closefile(parms.config_file);
  +
       if (errmsg) {
  -        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                     "Syntax error in -C/-c directive:" APR_EOL_STR "%s",
  -                     errmsg);
  -        exit(1);
  +        return apr_pstrcat(p, "Syntax error in -C/-c directive: ", errmsg,
  +                           NULL);
       }
   
  -    ap_cfg_closefile(parms.config_file);
  +    return NULL;
   }
   
   typedef struct {
  @@ -1403,15 +1412,16 @@
       return strcmp(f1->fname,f2->fname);
   }
   
  -static void process_resource_config_nofnmatch(server_rec *s, const char *fname,
  -                                              ap_directive_t **conftree,
  -                                              apr_pool_t *p,
  -                                              apr_pool_t *ptemp,
  -                                              unsigned depth)
  +static const char *process_resource_config_nofnmatch(server_rec *s,
  +                                                     const char *fname,
  +                                                     ap_directive_t **conftree,
  +                                                     apr_pool_t *p,
  +                                                     apr_pool_t *ptemp,
  +                                                     unsigned depth)
   {
       cmd_parms parms;
       ap_configfile_t *cfp;
  -    const char *errmsg;
  +    const char *error;
   
       if (ap_is_directory(p, fname)) {
           apr_dir_t *dirp;
  @@ -1420,14 +1430,13 @@
           apr_array_header_t *candidates = NULL;
           fnames *fnew;
           apr_status_t rv;
  -        char errmsg[120], *path = apr_pstrdup(p, fname);
  +        char *path = apr_pstrdup(p, fname);
   
           if (++depth > AP_MAX_INCLUDE_DIR_DEPTH) {
  -            fprintf(stderr, "%s: Directory %s exceeds the maximum include "
  -                    "directory nesting level of %u. You have probably a "
  -                    "recursion somewhere.\n", ap_server_argv0, path,
  -                    AP_MAX_INCLUDE_DIR_DEPTH);
  -            exit(1);
  +            return apr_psprintf(p, "Directory %s exceeds the maximum include "
  +                                "directory nesting level of %u. You have "
  +                                "probably a recursion somewhere.", path,
  +                                AP_MAX_INCLUDE_DIR_DEPTH);
           }
   
           /*
  @@ -1437,10 +1446,9 @@
            */
           rv = apr_dir_open(&dirp, path, p);
           if (rv != APR_SUCCESS) {
  -            fprintf(stderr, "%s: could not open config directory %s: %s\n",
  -                    ap_server_argv0, path,
  -                    apr_strerror(rv, errmsg, sizeof errmsg));
  -            exit(1);
  +            char errmsg[120];
  +            return apr_psprintf(p, "Could not open config directory %s: %s",
  +                                path, apr_strerror(rv, errmsg, sizeof errmsg));
           }
   
           candidates = apr_array_make(p, 1, sizeof(fnames));
  @@ -1464,12 +1472,16 @@
                */
               for (current = 0; current < candidates->nelts; ++current) {
                   fnew = &((fnames *) candidates->elts)[current];
  -                process_resource_config_nofnmatch(s, fnew->fname, conftree, p,
  -                                                  ptemp, depth);
  +                error = process_resource_config_nofnmatch(s, fnew->fname,
  +                                                          conftree, p, ptemp,
  +                                                          depth);
  +                if (error) {
  +                    return error;
  +                }
               }
           }
   
  -        return;
  +        return NULL;
       }
   
       /* GCC's initialization extensions are soooo nice here... */
  @@ -1480,35 +1492,28 @@
       parms.override = (RSRC_CONF | OR_ALL) & ~(OR_AUTHCFG | OR_LIMIT);
   
       if (ap_pcfg_openfile(&cfp, p, fname) != APR_SUCCESS) {
  -        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                     "%s: could not open document config file %s",
  -                     ap_server_argv0, fname);
  -        exit(1);
  +        return apr_pstrcat(p, "Could not open document config file ",
  +                           fname, NULL);
       }
   
       parms.config_file = cfp;
  +    error = ap_build_config(&parms, p, ptemp, conftree);
  +    ap_cfg_closefile(cfp);
   
  -    errmsg = ap_build_config(&parms, p, ptemp, conftree);
  -
  -    if (errmsg != NULL) {
  -        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                     "Syntax error on line %d of %s:",
  -                     parms.err_directive->line_num,
  -                     parms.err_directive->filename);
  -        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                     "%s", errmsg);
  -        exit(1);
  +    if (error) {
  +        return apr_psprintf(p, "Syntax error on line %d of %s: %s",
  +                            parms.err_directive->line_num,
  +                            parms.err_directive->filename, error);
       }
   
  -    ap_cfg_closefile(cfp);
  -
  -    return;
  +    return NULL;
   }
   
  -AP_DECLARE(void) ap_process_resource_config(server_rec *s, const char *fname,
  -                                            ap_directive_t **conftree,
  -                                            apr_pool_t *p,
  -                                            apr_pool_t *ptemp)
  +AP_DECLARE(const char *) ap_process_resource_config(server_rec *s,
  +                                                    const char *fname,
  +                                                    ap_directive_t **conftree,
  +                                                    apr_pool_t *p,
  +                                                    apr_pool_t *ptemp)
   {
       /* XXX: lstat() won't work on the wildcard pattern...
        */
  @@ -1520,11 +1525,12 @@
           apr_finfo_t finfo;
   
           if (apr_stat(&finfo, fname, APR_FINFO_LINK | APR_FINFO_TYPE, p) != APR_SUCCESS)
  -            return;
  +            return NULL;
       }
   
       if (!apr_fnmatch_test(fname)) {
  -        process_resource_config_nofnmatch(s, fname, conftree, p, ptemp, 0);
  +        return process_resource_config_nofnmatch(s, fname, conftree, p, ptemp,
  +                                                 0);
       }
       else {
           apr_dir_t *dirp;
  @@ -1533,7 +1539,7 @@
           apr_array_header_t *candidates = NULL;
           fnames *fnew;
           apr_status_t rv;
  -        char errmsg[120], *path = apr_pstrdup(p, fname), *pattern = NULL;
  +        char *path = apr_pstrdup(p, fname), *pattern = NULL;
   
           pattern = ap_strrchr(path, '/');
   
  @@ -1542,21 +1548,18 @@
           *pattern++ = '\0';
   
           if (apr_fnmatch_test(path)) {
  -            fprintf(stderr, "%s: wildcard patterns not allowed in Include "
  -                    "%s\n", ap_server_argv0, fname);
  -            exit(1);
  +            return apr_pstrcat(p, "Wildcard patterns not allowed in Include ",
  +                               fname, NULL);
           }
   
           if (!ap_is_directory(p, path)){ 
  -            fprintf(stderr, "%s: Include directory '%s' not found",
  -                    ap_server_argv0, path);
  -            exit(1);
  +            return apr_pstrcat(p, "Include directory '", path, "' not found",
  +                               NULL);
           }
   
           if (!apr_fnmatch_test(pattern)) {
  -            fprintf(stderr, "%s: must include a wildcard pattern "
  -                    "for Include %s\n", ap_server_argv0, fname);
  -            exit(1);
  +            return apr_pstrcat(p, "Must include a wildcard pattern for "
  +                               "Include ", fname, NULL);
           }
   
           /*
  @@ -1566,10 +1569,9 @@
            */
           rv = apr_dir_open(&dirp, path, p);
           if (rv != APR_SUCCESS) {
  -            fprintf(stderr, "%s: could not open config directory %s: %s\n",
  -                    ap_server_argv0, path,
  -                    apr_strerror(rv, errmsg, sizeof errmsg));
  -            exit(1);
  +            char errmsg[120];
  +            return apr_psprintf(p, "Could not open config directory %s: %s",
  +                                path, apr_strerror(rv, errmsg, sizeof errmsg));
           }
   
           candidates = apr_array_make(p, 1, sizeof(fnames));
  @@ -1586,6 +1588,8 @@
   
           apr_dir_close(dirp);
           if (candidates->nelts != 0) {
  +            const char *error;
  +
               qsort((void *) candidates->elts, candidates->nelts,
                     sizeof(fnames), fname_alphasort);
   
  @@ -1595,13 +1599,17 @@
                */
               for (current = 0; current < candidates->nelts; ++current) {
                   fnew = &((fnames *) candidates->elts)[current];
  -                process_resource_config_nofnmatch(s, fnew->fname, conftree, p,
  -                                                  ptemp, 0);
  +                error = process_resource_config_nofnmatch(s, fnew->fname,
  +                                                          conftree, p,
  +                                                          ptemp, 0);
  +                if (error) {
  +                    return error;
  +                }
               }
           }
       }
   
  -    return;
  +    return NULL;
   }
   
   AP_DECLARE(int) ap_process_config_tree(server_rec *s,
  @@ -1848,15 +1856,20 @@
                                          const char *filename,
                                          ap_directive_t **conftree)
   {
  -    const char *confname;
  +    const char *confname, *error;
       apr_pool_t *p = process->pconf;
       server_rec *s = init_server_config(process, p);
   
       init_config_globals(p);
   
       /* All server-wide config files now have the SAME syntax... */
  -    process_command_config(s, ap_server_pre_read_config, conftree,
  -                           p, ptemp);
  +    error = process_command_config(s, ap_server_pre_read_config, conftree,
  +                                   p, ptemp);
  +    if (error) {
  +        ap_log_error(APLOG_MARK, APLOG_STARTUP|APLOG_CRIT, 0, NULL, "%s: %s",
  +                     ap_server_argv0, error);
  +        return NULL;
  +    }
   
       /* process_command_config may change the ServerRoot so
        * compute this config file name afterwards.
  @@ -1867,13 +1880,24 @@
           ap_log_error(APLOG_MARK, APLOG_STARTUP|APLOG_CRIT,
                        APR_EBADPATH, NULL, "Invalid config file path %s",
                        filename);
  -        exit(1);
  +        return NULL;
       }
   
  -    ap_process_resource_config(s, confname, conftree, p, ptemp);
  +    error = ap_process_resource_config(s, confname, conftree, p, ptemp);
  +    if (error) {
  +        ap_log_error(APLOG_MARK, APLOG_STARTUP|APLOG_CRIT, 0, NULL,
  +                     "%s: %s", ap_server_argv0, error);
  +        return NULL;
  +    }
  +
  +    error = process_command_config(s, ap_server_post_read_config, conftree,
  +                                   p, ptemp);
   
  -    process_command_config(s, ap_server_post_read_config, conftree,
  -                           p, ptemp);
  +    if (error) {
  +        ap_log_error(APLOG_MARK, APLOG_STARTUP|APLOG_CRIT, 0, NULL, "%s: %s",
  +                     ap_server_argv0, error);
  +        return NULL;
  +    }
   
       return s;
   }
  
  
  
  1.276     +8 -3      httpd-2.0/server/core.c
  
  Index: core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/core.c,v
  retrieving revision 1.275
  retrieving revision 1.276
  diff -u -u -r1.275 -r1.276
  --- core.c	20 Apr 2004 20:22:13 -0000	1.275
  +++ core.c	25 Apr 2004 17:23:31 -0000	1.276
  @@ -2250,7 +2250,7 @@
                                      const char *name)
   {
       ap_directive_t *conftree = NULL;
  -    const char* conffile;
  +    const char* conffile, *error;
       unsigned *recursion;
       void *data;
   
  @@ -2278,8 +2278,13 @@
                              name, NULL);
       }
   
  -    ap_process_resource_config(cmd->server, conffile,
  -                               &conftree, cmd->pool, cmd->temp_pool);
  +    error = ap_process_resource_config(cmd->server, conffile,
  +                                       &conftree, cmd->pool, cmd->temp_pool);
  +    if (error) {
  +        *recursion = 0;
  +        return error;
  +    }
  +
       *(ap_directive_t **)dummy = conftree;
   
       /* recursion level done */
  
  
  
  1.157     +15 -1     httpd-2.0/server/main.c
  
  Index: main.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/main.c,v
  retrieving revision 1.156
  retrieving revision 1.157
  diff -u -u -r1.156 -r1.157
  --- main.c	29 Mar 2004 02:21:29 -0000	1.156
  +++ main.c	25 Apr 2004 17:23:31 -0000	1.157
  @@ -399,6 +399,7 @@
       const char *confname = SERVER_CONFIG_FILE;
       const char *def_server_root = HTTPD_ROOT;
       const char *temp_error_log = NULL;
  +    const char *error;
       process_rec *process;
       server_rec *server_conf;
       apr_pool_t *pglobal;
  @@ -427,7 +428,12 @@
       }
   #endif
   
  -    ap_setup_prelinked_modules(process);
  +    error = ap_setup_prelinked_modules(process);
  +    if (error) {
  +        ap_log_error(APLOG_MARK, APLOG_STARTUP|APLOG_EMERG, 0, NULL, "%s: %s",
  +                     ap_server_argv0, error);
  +        destroy_and_exit_process(process, 1);
  +    }
   
       apr_pool_create(&pcommands, pglobal);
       apr_pool_tag(pcommands, "pcommands");
  @@ -566,6 +572,10 @@
           ap_replace_stderr_log(process->pool, temp_error_log);
       }
       server_conf = ap_read_config(process, ptemp, confname, &ap_conftree);
  +    if (!server_conf) {
  +        destroy_and_exit_process(process, 1);
  +    }
  +
       if (ap_run_pre_config(pconf, plog, ptemp) != OK) {
           ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR, 0,
                        NULL, "Pre-configuration failed");
  @@ -631,6 +641,10 @@
           apr_pool_tag(ptemp, "ptemp");
           ap_server_root = def_server_root;
           server_conf = ap_read_config(process, ptemp, confname, &ap_conftree);
  +        if (!server_conf) {
  +            destroy_and_exit_process(process, 1);
  +        }
  +
           if (ap_run_pre_config(pconf, plog, ptemp) != OK) {
               ap_log_error(APLOG_MARK, APLOG_STARTUP |APLOG_ERR,
                            0, NULL, "Pre-configuration failed");