diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2003-06-27 13:25:48 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2003-06-27 13:25:48 +0000 |
commit | fd27872c64a90f8ea9fb1dbe9544891a41e8a8b2 (patch) | |
tree | a4ae00be742cff2886b20fa1714ccec4c29361a6 | |
parent | 1145b231d4b682478bdf052efbade9dbd2df11e8 (diff) | |
download | netsurf-fd27872c64a90f8ea9fb1dbe9544891a41e8a8b2.tar.gz netsurf-fd27872c64a90f8ea9fb1dbe9544891a41e8a8b2.tar.bz2 |
[project @ 2003-06-27 13:25:48 by jmb]
Fix crash when saving choices
svn path=/import/netsurf/; revision=188
-rw-r--r-- | riscos/options.c | 19 |
1 files 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 = "<Choices$Write>.NetSurf"; + dir = xcalloc(40, sizeof(char)); + fn = xcalloc(60, sizeof(char)); + + dir = strdup("<Choices$Write>.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) |