From 6f2d1b84131b0a9039562dbd96dbd27e0079f287 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 25 Jul 2010 17:27:37 -0700 Subject: [PATCH] core: don't hang if no config file is found If we can't find a configuration file, we need to do something slightly more friendly than hanging. Reported-by: Sebastian Herbszt Signed-off-by: H. Peter Anvin --- core/diskfs.inc | 2 +- core/extern.inc | 2 +- core/fs/fs.c | 5 ++++- core/isolinux.asm | 3 ++- core/pxelinux.asm | 11 ++++++----- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/core/diskfs.inc b/core/diskfs.inc index 9f18c76..a04a4f0 100644 --- a/core/diskfs.inc +++ b/core/diskfs.inc @@ -97,7 +97,7 @@ trackbuf resb trackbufsize ; Track buffer goes here ; ; Load configuration file ; - pm_call load_config + pm_call pm_load_config jz no_config_file ; diff --git a/core/extern.inc b/core/extern.inc index 64edea6..816659b 100644 --- a/core/extern.inc +++ b/core/extern.inc @@ -11,7 +11,7 @@ ; fs.c extern fs_init, pm_searchdir, getfssec, getfsbytes - extern pm_mangle_name, load_config + extern pm_mangle_name, pm_load_config extern pm_open_file, pm_close_file extern SectorSize, SectorShift diff --git a/core/fs/fs.c b/core/fs/fs.c index 48856c9..d10f6a8 100644 --- a/core/fs/fs.c +++ b/core/fs/fs.c @@ -77,7 +77,7 @@ void _close_file(struct file *file) * Convert between a 16-bit file handle and a file structure */ -void load_config(void) +void pm_load_config(com32sys_t *regs) { int err; @@ -85,6 +85,9 @@ void load_config(void) if (err) printf("ERROR: No configuration file found\n"); + + regs->eflags.l &= ~(EFLAGS_ZF | EFLAGS_CF); + regs->eflags.l |= err ? EFLAGS_ZF : 0; } void pm_mangle_name(com32sys_t *regs) diff --git a/core/isolinux.asm b/core/isolinux.asm index 1ef68d8..ca8ee3a 100644 --- a/core/isolinux.asm +++ b/core/isolinux.asm @@ -1186,7 +1186,8 @@ ROOT_FS_OPS: ; ; Locate the configuration file ; - pm_call load_config + pm_call pm_load_config + jz no_config_file ; ; Now we have the config file open. Parse the config file and diff --git a/core/pxelinux.asm b/core/pxelinux.asm index 8084ac9..a46b3da 100644 --- a/core/pxelinux.asm +++ b/core/pxelinux.asm @@ -253,11 +253,6 @@ ROOT_FS_OPS: ; ; -; Load configuration file -; - pm_call load_config - -; ; Linux kernel loading code is common. However, we need to define ; a couple of helper macros... ; @@ -269,6 +264,12 @@ ROOT_FS_OPS: %endmacro ; +; Load configuration file +; + pm_call pm_load_config + jz no_config_file + +; ; Now we have the config file open. Parse the config file and ; run the user interface. ; -- 2.7.4