]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Extend errorTryLoadText to accept absolute paths for page
authorAmos Jeffries <squid3@treenet.co.nz>
Sun, 12 Oct 2008 12:23:33 +0000 (01:23 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 12 Oct 2008 12:23:33 +0000 (01:23 +1300)
src/errorpage.cc

index 29eedb4e02d8c1443d9447698a528dd12b688404..2d6962adc8d2c6bb864ee0d9ee8aec3321a49b2b 100644 (file)
@@ -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) {