diff options
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -40,6 +40,12 @@ struct hcalc_config { char *home_dir = NULL; char config_path[MAX_HOME]; /* ludicrous size */ +void validate_numbers(void) { + if(!number_is_ok(value)) value = 0; + if(!number_is_ok(saved)) saved = 0; + if(!number_is_ok(stored)) stored = 0; +} + size_t filesize(FILE *f) { struct stat st; @@ -121,6 +127,8 @@ void load_config(void) { winsize = conf.winsize; base = conf.base; quiet = conf.quiet; + + validate_numbers(); } void save_config(void) { @@ -142,6 +150,8 @@ void save_config(void) { return; } + validate_numbers(); + memcpy(conf.signature, SIGNATURE, SIGLEN); conf.doublesize = sizeof(double); conf.value = value; |