Skip to content

Commit

Permalink
Do not load configuration in rescue mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastien Bourdeauducq committed Apr 23, 2011
1 parent ef61a83 commit 2c9f5e7
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/sysconfig.c
Expand Up @@ -27,6 +27,7 @@
#include <rtems.h>
#include <rtems/rtems_bsdnet.h>
#include <rtems/dhcp.h>
#include <rtems/bspcmdline.h>
#include <bsp.h>
#include <mtklib.h>

Expand Down Expand Up @@ -158,14 +159,26 @@ static void sysconfig_credentials_lock_init();
static void sysconfig_credentials_lock();
static void sysconfig_credentials_unlock();

static int is_rescue()
{
const char *bsp_cmdline;

bsp_cmdline = rtems_bsp_cmdline_get();
if(bsp_cmdline == NULL)
return 0;
return strcmp(bsp_cmdline, "rescue") == 0;
}

void sysconfig_load()
{
struct sysconfig conf;

sysconfig_credentials_lock_init();

if(readconfig(SYSCONFIG_FILE, &conf))
memcpy(&sysconfig, &conf, sizeof(struct sysconfig));
if(!is_rescue()) {
if(readconfig(SYSCONFIG_FILE, &conf))
memcpy(&sysconfig, &conf, sizeof(struct sysconfig));
}

if(sysconfig.dhcp_enable)
rtems_bsdnet_config.bootp = my_dhcp;
Expand Down

0 comments on commit 2c9f5e7

Please sign in to comment.