From 3bd36a474925bdee3259c33ba4d64027af06aabe Mon Sep 17 00:00:00 2001 From: Nikos Ntarmos Date: Sat, 5 Jan 2008 09:24:43 +0100 Subject: [PATCH] use default config file on parsing errors --- config.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/config.c b/config.c index 69e590198..ee4a273d1 100644 --- a/config.c +++ b/config.c @@ -729,12 +729,17 @@ config_parse(const char *confpatharg) if(ret == CFG_FILE_ERROR) { perror("awesome: parsing configuration file failed"); - cfg_parse_buf(cfg, AWESOME_DEFAULT_CONFIG); if(!(defconfig = fopen(confpath, "w"))) perror("awesome: unable to create default configuration file"); } else if(ret == CFG_PARSE_ERROR) cfg_error(cfg, "awesome: parsing configuration file %s failed.\n", confpath); + if(ret != CFG_SUCCESS) { + fprintf(stderr, "Using default compile-time configuration\n"); + cfg_free(cfg); + cfg = cfg_init(opts, CFGF_NONE); + cfg_parse_buf(cfg, AWESOME_DEFAULT_CONFIG); + } /* get the right screen section */ for(screen = 0; screen < get_screen_count(); screen++)