summaryrefslogtreecommitdiffstats
path: root/x11-libs/gtk+/files/gtk+-1.2.10-mdk-fileselectorfallback.patch
diff options
context:
space:
mode:
Diffstat (limited to 'x11-libs/gtk+/files/gtk+-1.2.10-mdk-fileselectorfallback.patch')
-rw-r--r--x11-libs/gtk+/files/gtk+-1.2.10-mdk-fileselectorfallback.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/x11-libs/gtk+/files/gtk+-1.2.10-mdk-fileselectorfallback.patch b/x11-libs/gtk+/files/gtk+-1.2.10-mdk-fileselectorfallback.patch
new file mode 100644
index 0000000..c2d895c
--- /dev/null
+++ b/x11-libs/gtk+/files/gtk+-1.2.10-mdk-fileselectorfallback.patch
@@ -0,0 +1,46 @@
+--- gtk+-1.2.10/gtk/gtkfilesel.c.fileselectorfallback 2002-09-11 11:25:27.000000000 +0200
++++ gtk+-1.2.10/gtk/gtkfilesel.c 2002-09-11 13:05:39.000000000 +0200
+@@ -1578,6 +1578,7 @@
+ {
+ gchar getcwd_buf[2*MAXPATHLEN];
+ CompletionState *new_state;
++ gint fallback = 0;
+
+ new_state = g_new (CompletionState, 1);
+
+@@ -1594,6 +1595,7 @@
+ * a root directory, right? Right? (Probably not portable to non-Unix)
+ */
+ strcpy (getcwd_buf, "/");
++ fallback = 1;
+ }
+
+ tryagain:
+@@ -1616,7 +1618,26 @@
+ if (!new_state->reference_dir)
+ {
+ /* Directories changing from underneath us, grumble */
+- strcpy (getcwd_buf, "/");
++ if (fallback == 0) {
++ strcpy (getcwd_buf, "/");
++ fallback = 1;
++ }
++ else {
++ if (fallback == 1) { /* last try with user home dir */
++ if (g_get_home_dir ()) {
++ strcpy (getcwd_buf, g_get_home_dir ());
++ }
++ fallback = 2;
++ }
++ else {
++ g_error ("no readable fallback directory found for GtkFileSelector, exiting");
++ }
++ }
++ /* don't leak updated_text and the_completion.text */
++ if (new_state->the_completion.text)
++ g_free (new_state->the_completion.text);
++ if (new_state->updated_text)
++ g_free (new_state->updated_text);
+ goto tryagain;
+ }
+