[Github-comments] [geany/geany] prefer XDG_RUNTIME_DIR over /tmp for the socket (#2222)

Colomban Wendling notifications at xxxxx
Tue Jul 30 07:30:46 UTC 2019


b4n commented on this pull request.



> @@ -439,20 +441,35 @@ static gint socket_fd_open_unix(const gchar *path)
 		return -1;
 	}
 
-	/* fix for #1888561:
-	 * in case the configuration directory is located on a network file system or any other
-	 * file system which doesn't support sockets, we just link the socket there and create the
-	 * real socket in the system's tmp directory assuming it supports sockets */
-	real_path = g_strdup_printf("%s%cgeany_socket.%08x",
-		g_get_tmp_dir(), G_DIR_SEPARATOR, g_random_int());
+	/* Try to place the socket in XDG_RUNTIME_DIR, according to XDG Base
+	 * Directory Specification, see
+	 * https://specifications.freedesktop.org/basedir-spec/latest */
+	real_dir = g_build_filename(g_get_user_runtime_dir(), "geany", NULL);
+	if (g_mkdir_with_parents(real_dir, 0755) == 0)
+	{
+		basename = g_path_get_basename(path);
+		real_path = g_build_filename(real_dir, basename, NULL);
+	}

This should already be fixed in the current version of the changes, it uses the same basename as it used to, including the random integer (which is admittedly not necessarily the smartest idea as there's a faint chance of clashes, but well, it seems to have served us good enough 'til now).

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/2222#discussion_r308570897
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20190730/f8bbdd3a/attachment.html>


More information about the Github-comments mailing list