[syslinux:elflink] ldlinux: chdir to the APPEND str when parsing a CONFIG directive
syslinux-bot for Matt Fleming
matt.fleming at intel.com
Mon Mar 26 15:36:06 PDT 2012
Commit-ID: db63acbdcd3603bbd42238dac19902ce00fe5d59
Gitweb: http://www.syslinux.org/commit/db63acbdcd3603bbd42238dac19902ce00fe5d59
Author: Matt Fleming <matt.fleming at intel.com>
AuthorDate: Tue, 13 Mar 2012 10:06:59 +0000
Committer: Matt Fleming <matt.fleming at intel.com>
CommitDate: Fri, 23 Mar 2012 16:56:16 +0000
ldlinux: chdir to the APPEND str when parsing a CONFIG directive
If an APPEND directive was specified for a CONFIG label then we need
to chdir to that directory after parsing the new config file.
Signed-off-by: Matt Fleming <matt.fleming at intel.com>
---
com32/elflink/ldlinux/execute.c | 4 ++++
com32/elflink/ldlinux/readconfig.c | 5 +++++
core/fs/lib/searchconfig.c | 1 +
core/include/core.h | 1 +
4 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/com32/elflink/ldlinux/execute.c b/com32/elflink/ldlinux/execute.c
index c01d63f..b3ed958 100644
--- a/com32/elflink/ldlinux/execute.c
+++ b/com32/elflink/ldlinux/execute.c
@@ -96,6 +96,10 @@ void execute(const char *cmdline, enum kernel_type type)
/* kernel contains the config file name */
realpath(ConfigName, kernel, FILENAME_MAX);
+ /* If we got anything on the command line, do a chdir */
+ if (*args)
+ mangle_name(config_cwd, args);
+
start_ldlinux("ldlinux.c32", 1, argv);
} else {
/* process the image need int 22 support */
diff --git a/com32/elflink/ldlinux/readconfig.c b/com32/elflink/ldlinux/readconfig.c
index 564cbef..573d724 100644
--- a/com32/elflink/ldlinux/readconfig.c
+++ b/com32/elflink/ldlinux/readconfig.c
@@ -1345,6 +1345,11 @@ static int parse_one_config(const char *filename)
f = fdopen(fd, mode);
parse_config_file(f);
+ if (config_cwd[0]) {
+ chdir(config_cwd);
+ config_cwd[0] = NULL;
+ }
+
return 0;
}
diff --git a/core/fs/lib/searchconfig.c b/core/fs/lib/searchconfig.c
index 7fdad18..f688e7f 100644
--- a/core/fs/lib/searchconfig.c
+++ b/core/fs/lib/searchconfig.c
@@ -5,6 +5,7 @@
#include <fs.h>
char ConfigName[FILENAME_MAX];
+char config_cwd[FILENAME_MAX];
/*
* Common implementation of load_config
diff --git a/core/include/core.h b/core/include/core.h
index a247d49..d2aaf72 100644
--- a/core/include/core.h
+++ b/core/include/core.h
@@ -18,6 +18,7 @@ extern char trackbuf[];
extern char CurrentDirName[];
extern char SubvolName[];
extern char ConfigName[];
+extern char config_cwd[];
extern char KernelName[];
extern char cmd_line[];
extern char ConfigFile[];
More information about the Syslinux-commits
mailing list