Author: neels
Date: Mon Jan 16 18:08:13 2012
New Revision: 1232085

URL: http://svn.apache.org/viewvc?rev=1232085&view=rev
Log:
* contrib/server-side/mod_setlocale/mod_setlocale.c
  (setlocale_post_config): Disallow a set_ctype of NULL, use "" instead.
Found by: philip

Modified:
    subversion/trunk/contrib/server-side/mod_setlocale/mod_setlocale.c

Modified: subversion/trunk/contrib/server-side/mod_setlocale/mod_setlocale.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/contrib/server-side/mod_setlocale/mod_setlocale.c?rev=1232085&r1=1232084&r2=1232085&view=diff
==============================================================================
--- subversion/trunk/contrib/server-side/mod_setlocale/mod_setlocale.c 
(original)
+++ subversion/trunk/contrib/server-side/mod_setlocale/mod_setlocale.c Mon Jan 
16 18:08:13 2012
@@ -86,6 +86,16 @@ setlocale_post_config(apr_pool_t *pconf,
       return HTTP_INTERNAL_SERVER_ERROR;
     }
 
+  /* If the user omitted a configuration directive, then set_ctype will be
+   * NULL.  Below condition sets it to "" instead, which loads the default as
+   * determined by the environment.  httpd's env is typically set by
+   * /etc/apache2/envvars, where LANG defaults to 'C', but it can be set to
+   * the system default there by sourcing the system's config file (e.g. '.
+   * /etc/default/locale'). Then, it suffices to just load this module to
+   * obtain the system's default locale. */
+  if (cfg->set_ctype == NULL)
+    cfg->set_ctype = "";
+
   cfg->old_ctype = setlocale(LC_CTYPE, cfg->set_ctype);
   if (cfg->old_ctype)
     {


Reply via email to