aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2012-03-13 10:06:59 +0000
committerMatt Fleming <matt.fleming@intel.com>2012-03-23 16:56:16 +0000
commitdb63acbdcd3603bbd42238dac19902ce00fe5d59 (patch)
tree5415bacab1d691d713e6c694d3a68cb834203443
parent3dfe95eb4c8729d479043710a9f43456a2f6bf1d (diff)
downloadsyslinux-db63acbdcd3603bbd42238dac19902ce00fe5d59.tar.gz
syslinux-db63acbdcd3603bbd42238dac19902ce00fe5d59.tar.xz
syslinux-db63acbdcd3603bbd42238dac19902ce00fe5d59.zip
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@intel.com>
-rw-r--r--com32/elflink/ldlinux/execute.c4
-rw-r--r--com32/elflink/ldlinux/readconfig.c5
-rw-r--r--core/fs/lib/searchconfig.c1
-rw-r--r--core/include/core.h1
4 files changed, 11 insertions, 0 deletions
diff --git a/com32/elflink/ldlinux/execute.c b/com32/elflink/ldlinux/execute.c
index c01d63f4..b3ed9583 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 564cbeff..573d7246 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 7fdad183..f688e7f2 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 a247d49f..d2aaf72d 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[];