httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoffrey Young <gyo...@laserlink.net>
Subject server config directory patch
Date Wed, 03 Jan 2001 15:25:00 GMT
hi all...

here's a little patch that avoids parsing .files when loading up server
config directories.  

At least on Linux, vi creates .file.swp when file is edited, which then
prevents the server from starting/restarting (since .file.swp is funky).
Not that you can't spend 3 seconds and remove the file, but I was thinking
that maybe avoiding .files was a good idea in general...

The regex looks for /. in the path+file, which is unix specific, but I don't
think windows assigns the same meaning to .files, so it may be a non-issue
for them.

anyway, I realize it's late to get it into 1.3.15 (if anyone is interested
at all, that is - it's really no biggie) so I'm just offering it up for what
it's worth.  I'm not a C programmer at all, and I wasn't sure whether I
needed to call ap_pregfree() explicitly, so feel free to clean it up as
necessary...

--Geoff

BTW, http://dev.apache.org/from-cvs/ is 404, which is why this patch is
against 1.3.14 and not cvs, sorry :)


--- http_config.c.old   Tue Oct  3 12:39:40 2000
+++ http_config.c       Wed Jan  3 09:23:41 2001
@@ -1204,6 +1204,7 @@
     const char *errmsg;
     cmd_parms parms;
     struct stat finfo;
+    regex_t *r = NULL;
 
     fname = ap_server_root_relative(p, fname);
 
@@ -1269,8 +1270,17 @@
             */
            for (current = 0; current < candidates->nelts; ++current) {
                fnew = &((fnames *) candidates->elts)[current];
-               fprintf(stderr, " Processing config file: %s\n",
fnew->fname);
-               ap_process_resource_config(s, fnew->fname, p, ptemp);
+                /*
+                * use regex to skip .files
+                */
+                r = ap_pregcomp(p, "/\\.", REG_EXTENDED);
+                if (!ap_regexec(r, fnew->fname, 0, NULL, 0)) {
+                 fprintf(stderr, " Skipping config file: %s\n",
fnew->fname);
+                } 
+                else {
+                 fprintf(stderr, " Processing config file: %s\n",
fnew->fname);
+                 ap_process_resource_config(s, fnew->fname, p, ptemp);
+                }
            }
        }
        return;

Mime
View raw message