summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2010-07-02 16:01:19 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2010-07-02 16:01:19 -0700
commitf88518c9b3538b229bc4e877fcc64a5e1515da8b (patch)
tree13814f1102c9ba4b0ec8f579c320bc0654a90cdd
parentb6642907cee0174344b2944eefaf459da23e2541 (diff)
downloadsyslinux-f88518c9b3538b229bc4e877fcc64a5e1515da8b.tar.gz
syslinux-f88518c9b3538b229bc4e877fcc64a5e1515da8b.tar.xz
syslinux-f88518c9b3538b229bc4e877fcc64a5e1515da8b.zip
core: always canonicalize the configuration file name
The FAT installers may not produce a canonical pathname in the CurrentDirName field on entry. Make sure that the core doesn't croak when that happens, and still produces an absolute pathname for the configuration file. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r--core/fs/lib/loadconfig.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/fs/lib/loadconfig.c b/core/fs/lib/loadconfig.c
index 356d5a2e..db538b87 100644
--- a/core/fs/lib/loadconfig.c
+++ b/core/fs/lib/loadconfig.c
@@ -13,6 +13,7 @@
*/
int generic_load_config(void)
{
+ char confignamebuf[FILENAME_MAX];
static const char *search_directories[] = {
NULL, /* CurrentDirName */
"/boot/syslinux",
@@ -36,9 +37,11 @@ int generic_load_config(void)
const char *sd = search_directories[i];
for (j = 0; filenames[j]; j++) {
memset(&regs, 0, sizeof regs);
- snprintf(ConfigName, FILENAME_MAX, "%s%s%s",
+ snprintf(confignamebuf, sizeof confignamebuf,
+ "%s%s%s",
sd, (*sd && sd[strlen(sd)-1] == '/') ? "" : "/",
filenames[j]);
+ realpath(ConfigName, confignamebuf, FILENAME_MAX);
regs.edi.w[0] = OFFS_WRT(ConfigName, 0);
dprintf("Config search: %s\n", ConfigName);
call16(core_open, &regs, &regs);