From: Amos Jeffries Date: Sun, 12 Oct 2008 12:23:33 +0000 (+1300) Subject: Extend errorTryLoadText to accept absolute paths for page X-Git-Tag: SQUID_3_2_0_1~1386^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=45308e4dd27eaeb48e5a703dceeece746b5e75c2;p=thirdparty%2Fsquid.git Extend errorTryLoadText to accept absolute paths for page --- diff --git a/src/errorpage.cc b/src/errorpage.cc index 29eedb4e02..2d6962adc8 100644 --- a/src/errorpage.cc +++ b/src/errorpage.cc @@ -190,7 +190,7 @@ errorInitialize(void) // look for and load stylesheet into global MemBuf for it. if(Config.errorStylesheet) { - char *temp = errorLoadText(Config.errorStylesheet); + char *temp = errorTryLoadText(Config.errorStylesheet,NULL); if(temp) { error_stylesheet.Printf("%s",temp); safe_free(temp); @@ -281,7 +281,12 @@ errorTryLoadText(const char *page_name, const char *dir, bool silent) ssize_t len; MemBuf textbuf; - snprintf(path, sizeof(path), "%s/%s", dir, page_name); + // maybe received compound parts, maybe an absolute page_name and no dir + if(dir) + snprintf(path, sizeof(path), "%s/%s", dir, page_name); + else + snprintf(path, sizeof(path), "%s", page_name); + fd = file_open(path, O_RDONLY | O_TEXT); if (fd < 0) {