aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2013-02-28 17:44:54 +0000
committerMatt Fleming <matt.fleming@intel.com>2013-03-07 12:17:26 +0000
commit5447ef821c24b526079ef785d2454ed0efff3e2b (patch)
tree0d72418129dc18449ae26c6f1758aa8a7df9d927
parent4153b9005c460e02d36c457367a045444812bb97 (diff)
downloadsyslinux-5447ef821c24b526079ef785d2454ed0efff3e2b.tar.gz
syslinux-5447ef821c24b526079ef785d2454ed0efff3e2b.tar.xz
syslinux-5447ef821c24b526079ef785d2454ed0efff3e2b.zip
ldlinux: Always update ConfigName when opening a config file
With the introduction of commit aa7dd29db684 ("ldlinux: Pass config filename as argv[1] to ldlinux.c32") we stopped using ConfigName to store the filename of the config file we intend to open in execute() since it interfered with the filesystem-specific open_config() implementations. But a side-effect of this change is that syslinux_config_file() no longer works if we explicitly pass a filename to parse_config_file(). The logical place to keep ConfigName in sync is in parse_config_file() since it's expected that all the filesystem-specific open_config() functions will fill out ConfigName for us. In the case where the filename is supplied by the caller, we need to fill it out ourselves. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-rw-r--r--com32/elflink/ldlinux/readconfig.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/com32/elflink/ldlinux/readconfig.c b/com32/elflink/ldlinux/readconfig.c
index 0f11d157..036a1df5 100644
--- a/com32/elflink/ldlinux/readconfig.c
+++ b/com32/elflink/ldlinux/readconfig.c
@@ -1399,6 +1399,15 @@ static int parse_one_config(const char *filename)
f = fdopen(fd, mode);
parse_config_file(f);
+ /*
+ * Update ConfigName so that syslinux_config_file() returns
+ * the filename we just opened. filesystem-specific
+ * open_config() implementations are expected to update
+ * ConfigName themselves.
+ */
+ if (filename)
+ strcpy(ConfigName, filename);
+
return 0;
}