From: Fredrik Tolf Date: Tue, 31 Aug 2010 19:38:35 +0000 (+0200) Subject: dirplex: Fixed up handledir a bit. X-Git-Tag: 0.1~51 X-Git-Url: http://www.dolda2000.com/gitweb/?p=ashd.git;a=commitdiff_plain;h=9bebca54879412ae5879695800ceac77eb2c805c dirplex: Fixed up handledir a bit. --- diff --git a/src/dirplex.c b/src/dirplex.c index 60f0859..8e4ae11 100644 --- a/src/dirplex.c +++ b/src/dirplex.c @@ -444,13 +444,13 @@ static void handledir(struct hthead *req, int fd, char *path) struct config **cfs; int i, o; struct stat sb; - char *inm, *ipath, *p; + char *inm, *ipath, *p, *cpath; DIR *dir; struct dirent *dent; struct pattern *pat; - path = sprintf2("%s/", path); - cfs = getconfigs(path); + cpath = sprintf2("%s/", path); + cfs = getconfigs(cpath); for(i = 0; cfs[i] != NULL; i++) { if(cfs[i]->index != NULL) { for(o = 0; cfs[i]->index[o] != NULL; o++) { @@ -489,14 +489,14 @@ static void handledir(struct hthead *req, int fd, char *path) break; } } - if((pat = findmatch(path, 0, 1)) != NULL) { - handle(req, fd, path, pat); + if((pat = findmatch(cpath, 0, 1)) != NULL) { + handle(req, fd, cpath, pat); goto out; } simpleerror(fd, 403, "Not Authorized", "Will not send listings for this directory."); out: - free(path); + free(cpath); } static int checkdir(struct hthead *req, int fd, char *path)