core: don't hang if no config file is found
authorH. Peter Anvin <hpa@zytor.com>
Mon, 26 Jul 2010 00:27:37 +0000 (17:27 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Mon, 26 Jul 2010 00:28:10 +0000 (17:28 -0700)
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>
core/diskfs.inc
core/extern.inc
core/fs/fs.c
core/isolinux.asm
core/pxelinux.asm

index 9f18c76..a04a4f0 100644 (file)
@@ -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
 
 ;
index 64edea6..816659b 100644 (file)
@@ -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
 
index 48856c9..d10f6a8 100644 (file)
@@ -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)
index 1ef68d8..ca8ee3a 100644 (file)
@@ -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
index 8084ac9..a46b3da 100644 (file)
@@ -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.
 ;