]> 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 08:35:57 +0000 (02:35 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 7 May 2013 08:35:57 +0000 (02:35 -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 75f54dfd1242e5844ecba4648e65c9bdf9f424cb..9bc9b7212d59bed76b89ccdd1f840e1041875545 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);