From 5447ef821c24b526079ef785d2454ed0efff3e2b Mon Sep 17 00:00:00 2001 From: Matt Fleming Date: Thu, 28 Feb 2013 17:44:54 +0000 Subject: [PATCH] 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 --- 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); 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; } -- 2.7.4