OSDN Git Service

*Segmentation fault If ChxjImageCacheDir does NOT exist
authorcoltware <coltware@94a86f0a-4377-0410-8349-a3afc59ff858>
Fri, 19 Feb 2010 15:58:54 +0000 (15:58 +0000)
committerAtsushi Konno <konn@users.sourceforge.jp>
Thu, 13 May 2010 16:27:09 +0000 (01:27 +0900)
src/mod_chxj.c [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 8e5e218..fd11779
@@ -2317,6 +2317,17 @@ cmd_set_image_cache_dir(cmd_parms *parms, void *mconfig, const char *arg)
 
   if (strlen(arg) > 256) 
     return "cache dir name is too long.";
+  
+  apr_finfo_t info;
+  apr_status_t res = apr_stat(&info,arg,APR_FINFO_TYPE,parms->pool);
+  if(res != APR_SUCCESS){
+    return apr_psprintf(parms->pool,"ChxjImageCacheDir [%s]: not found ",arg);
+  }
+  else{
+    if(info.filetype != APR_DIR){
+      return apr_psprintf(parms->pool,"ChxjImageCacheDir [%s]: is not directory ",arg);
+    }
+  }
 
   conf = (mod_chxj_config *)mconfig;
   conf->image_cache_dir = apr_pstrdup(parms->pool, arg);