aboutsummaryrefslogtreecommitdiffstats
path: root/debian/patches/120_config-file-handling.patch
blob: ded2c850d67b25139b1cbcae706cc397577580eb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Description: Fix segfault when changing options if ~/.w3m not accessible
Origin: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=366284#5
Author: Karsten Schoelzel <kuser@gmx.de>
Bug-Debian: http://bugs.debian.org/366284

diff --git a/rc.c b/rc.c
index 17f30d8..b88a3fd 100644
--- a/rc.c
+++ b/rc.c
@@ -1253,7 +1253,7 @@ init_rc(void)
 	interpret_rc(f);
 	fclose(f);
     }
-    if ((f = fopen(config_file, "rt")) != NULL) {
+    if (config_file && (f = fopen(config_file, "rt")) != NULL) {
 	interpret_rc(f);
 	fclose(f);
     }
@@ -1265,6 +1265,8 @@ init_rc(void)
 	((tmp_dir = getenv("TMP")) == NULL || *tmp_dir == '\0') &&
 	((tmp_dir = getenv("TEMP")) == NULL || *tmp_dir == '\0'))
 	tmp_dir = "/tmp";
+    create_option_search_table();
+    goto open_rc;
 }
 
 
@@ -1446,8 +1448,8 @@ panel_set_option(struct parsed_tagarg *a
     FILE *f = NULL;
     char *p;
 
-    if (no_rc_dir) {
-	disp_message("There's no ~/.w3m directory... config not saved", FALSE);
+    if (config_file == NULL) {
+	disp_message("There's no config file... config not saved", FALSE);
     }
     else {
 	f = fopen(config_file, "wt");