[syslinux:elflink] ldlinux: Always update ConfigName when opening a config file

syslinux-bot for Matt Fleming matt.fleming at intel.com
Thu Mar 7 04:54:05 PST 2013

Commit-ID:  5447ef821c24b526079ef785d2454ed0efff3e2b
Gitweb:     http://www.syslinux.org/commit/5447ef821c24b526079ef785d2454ed0efff3e2b
Author:     Matt Fleming <matt.fleming at intel.com>
AuthorDate: Thu, 28 Feb 2013 17:44:54 +0000
Committer:  Matt Fleming <matt.fleming at intel.com>
CommitDate: Thu, 7 Mar 2013 12:17:26 +0000

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 at intel.com>

 com32/elflink/ldlinux/readconfig.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/com32/elflink/ldlinux/readconfig.c b/com32/elflink/ldlinux/readconfig.c
index 0f11d15..036a1df 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);
+	/*
+	 * 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;

More information about the Syslinux-commits mailing list