aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2010-07-25 17:27:37 -0700
committerH. Peter Anvin <hpa@zytor.com>2010-07-25 17:28:10 -0700
commit6f2d1b84131b0a9039562dbd96dbd27e0079f287 (patch)
tree45bb405516eb2abfc37abeee6b54a1ec5ee664fa
parent4ad669661e034f6069c3ce0d6b97a8f297cf33b3 (diff)
downloadhdt-pierre-6f2d1b84131b0a9039562dbd96dbd27e0079f287.tar.gz
hdt-pierre-6f2d1b84131b0a9039562dbd96dbd27e0079f287.tar.xz
hdt-pierre-6f2d1b84131b0a9039562dbd96dbd27e0079f287.zip
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 <herbszt@gmx.de> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--core/diskfs.inc2
-rw-r--r--core/extern.inc2
-rw-r--r--core/fs/fs.c5
-rw-r--r--core/isolinux.asm3
-rw-r--r--core/pxelinux.asm11
5 files changed, 14 insertions, 9 deletions
diff --git a/core/diskfs.inc b/core/diskfs.inc
index 9f18c765..a04a4f0d 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 64edea61..816659b7 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 48856c9e..d10f6a83 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 1ef68d8c..ca8ee3a3 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 8084ac9a..a46b3da5 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.
;