From fd27872c64a90f8ea9fb1dbe9544891a41e8a8b2 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Fri, 27 Jun 2003 13:25:48 +0000 Subject: [project @ 2003-06-27 13:25:48 by jmb] Fix crash when saving choices svn path=/import/netsurf/; revision=188 --- riscos/options.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/riscos/options.c b/riscos/options.c index 98baa23dd..bcbe7e3ff 100644 --- a/riscos/options.c +++ b/riscos/options.c @@ -1,5 +1,5 @@ /** - * $Id: options.c,v 1.4 2003/06/08 04:00:05 jmb Exp $ + * $Id: options.c,v 1.5 2003/06/27 13:25:48 jmb Exp $ */ #include "netsurf/desktop/options.h" @@ -63,7 +63,10 @@ void options_write(struct options* opt, char* filename) char* fn, *dir; FILE* f; - dir = ".NetSurf"; + dir = xcalloc(40, sizeof(char)); + fn = xcalloc(60, sizeof(char)); + + dir = strdup(".NetSurf"); fn = strdup(dir); strcat(fn, "."); @@ -74,6 +77,8 @@ void options_write(struct options* opt, char* filename) xosfile_create_dir(dir, 0); + LOG(("filename: %s", fn)); + f = fopen(fn, "w"); if (f != NULL) { @@ -91,8 +96,12 @@ void options_write(struct options* opt, char* filename) fprintf(f, "\n# Theme\n"); fprintf(f, "RO_THEME:%s\n", opt->theme); } + else + LOG(("Couldn't open Choices file")); fclose(f); + xfree(dir); +// xfree(fn); } void options_init(struct options* opt) @@ -116,7 +125,8 @@ void options_read(struct options* opt, char* filename) char* fn; int size; - fn = "Choices:NetSurf."; + fn = xcalloc(40,sizeof(char)); + fn = strdup("Choices:NetSurf."); LOG(("Testing filename")); if (filename == NULL) @@ -153,6 +163,9 @@ void options_read(struct options* opt, char* filename) xfree(opt->theme); opt->theme = lookup(&cb, "RO_THEME", "Default"); + messagetrans_close_file(&cb); + xfree(data); +// xfree(fn); } void options_to_ro(struct options* opt, struct ro_choices* ro) -- cgit v1.2.3