Package: w3m
Version: 0.5.1-4
Severity: normal
Tags: patch

If ~/.w3m doesn't exist and can not be created or is no directory then
w3m segfaults if you change a option (either in the option panel or via
-o option_name=value). This is fixed in the attached patch.
With this patch w3m will read the system-wide config files and honours
 -config filename option in this case.

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.15
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Regards,
-- 
Karsten Schölzel        | Email:  [EMAIL PROTECTED]
Väderleden 9 4:98       | Jabber: [EMAIL PROTECTED]
97633 Luleå             | VoIP:   sip:[EMAIL PROTECTED]
Sweden                  |         sip:[EMAIL PROTECTED]
                        | Tel:    +4918015855857712
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");

Reply via email to