]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Polish: show file path on Bungled lines
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 7 May 2013 09:17:00 +0000 (03:17 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 7 May 2013 09:17:00 +0000 (03:17 -0600)
Since include directive was added it is entirely possible that two files
are loaded from the same filename on different paths.

This also enables automated tools to make use of the displayed filename
to manipulate the relevant file.

src/cache_cf.cc

index ca774bf54dae9dcbc3187f8f0da8aafbeaabddf2..598de58dc087d12a7f7aaa8db6984c870ee19c0e 100644 (file)
@@ -300,14 +300,10 @@ update_maxobjsize(void)
 static void
 SetConfigFilename(char const *file_name, bool is_pipe)
 {
-    cfg_filename = file_name;
-
-    char const *token;
-
     if (is_pipe)
         cfg_filename = file_name + 1;
-    else if ((token = strrchr(cfg_filename, '/')))
-        cfg_filename = token + 1;
+    else
+        cfg_filename = file_name;
 }
 
 static const char*
@@ -528,7 +524,7 @@ parseOneConfigFile(const char *file_name, unsigned int depth)
                 if ((token = strchr(new_file_name, '"')))
                     *token = '\0';
 
-                cfg_filename = new_file_name;
+                SetConfigFilename(new_file_name, false);
             }
 
             config_lineno = new_lineno;
@@ -598,7 +594,7 @@ parseOneConfigFile(const char *file_name, unsigned int depth)
         fclose(fp);
     }
 
-    cfg_filename = orig_cfg_filename;
+    SetConfigFilename(orig_cfg_filename, false);
     config_lineno = orig_config_lineno;
 
     xfree(tmp_line);