Blob Blame History Raw
--- src/interfaces/gtk/ec_gtk_conf.c~	2011-12-04 17:24:30.000000000 -0600
+++ src/interfaces/gtk/ec_gtk_conf.c	2012-01-26 13:43:04.201897836 -0600
@@ -69,15 +69,9 @@
    char line[100], name[30];
    short value;
 
-#ifdef OS_WINDOWS
-   path = ec_win_get_user_dir();
-#else
-   /* TODO: get the dopped privs home dir instead of "/root" */
-   /* path = g_get_home_dir(); */
-   path = g_get_tmp_dir();
-#endif
+   path = g_get_user_config_dir();
 
-   filename = g_build_filename(path, ".ettercap_gtk", NULL);
+   filename = g_build_filename(path, "ettercap_gtk", NULL);
 
    DEBUG_MSG("gtkui_conf_read: %s", filename);
 
@@ -86,8 +80,14 @@
       return;
 
    while(fgets(line, 100, fd)) {
-      sscanf(line, "%s = %hd", name, &value);
-
+      char *p = strchr(line, '=');
+      if(!p)
+         continue;
+      *p = '\0';
+      snprintf(name, sizeof(name), "%s", line);
+      strlcpy(name, line, sizeof(name) - 1);
+      g_strstrip(name);
+      value = atoi(p + 1);
       gtkui_conf_set(name, value);
    }
    fclose(fd);