37 lines
1.0 KiB
Plaintext
37 lines
1.0 KiB
Plaintext
$OpenBSD: patch-glib_gutils_c,v 1.8 2019/03/27 12:54:47 ajacoutot Exp $
|
|
|
|
Check if the XDG directories actually exist before adding them to the list which
|
|
is specially important for programs using unveil(2).
|
|
|
|
Index: glib/gutils.c
|
|
--- glib/gutils.c.orig
|
|
+++ glib/gutils.c
|
|
@@ -1576,7 +1576,7 @@ load_user_special_dirs (void)
|
|
for (i = 0; i < n_lines; i++)
|
|
{
|
|
gchar *buffer = lines[i];
|
|
- gchar *d, *p;
|
|
+ gchar *d, *p, *td;
|
|
gint len;
|
|
gboolean is_relative = FALSE;
|
|
GUserDirectory directory;
|
|
@@ -1668,11 +1668,14 @@ load_user_special_dirs (void)
|
|
d[len - 1] = 0;
|
|
|
|
if (is_relative)
|
|
- {
|
|
- g_user_special_dirs[directory] = g_build_filename (g_get_home_dir (), d, NULL);
|
|
- }
|
|
+ td = g_build_filename (g_get_home_dir (), d, NULL);
|
|
else
|
|
- g_user_special_dirs[directory] = g_strdup (d);
|
|
+ td = g_strdup (d);
|
|
+
|
|
+ if (g_file_test (td, G_FILE_TEST_IS_DIR))
|
|
+ g_user_special_dirs[directory] = g_strdup (td);
|
|
+
|
|
+ g_free(td);
|
|
}
|
|
|
|
g_strfreev (lines);
|