<p><b>@b4n</b> approved this pull request.</p>

<p>Apart from the nitpicking below, LGTM</p><hr>

<p>In <a href="https://github.com/geany/geany/pull/2222#discussion_r307999930">src/socket.c</a>:</p>
<pre style='color:#555'>>  
        if (utils_is_file_writable(real_path) != 0)
        {       /* if real_path is not writable for us, fall back to ~/.config/geany/geany_socket_*_* */
                /* instead of creating a symlink and print a warning */
                g_warning("Socket %s could not be written, using %s as fallback.", real_path, path);
                SETPTR(real_path, g_strdup(path));
        }
-       /* create a symlink in e.g. ~/.config/geany/geany_socket_hostname__0 to /tmp/geany_socket.499602d2 */
+       /* create a symlink in e.g. ~/.config/geany/geany_socket_hostname__0 to
+        * /var/run/user/1000/geany/geany_socket_hostname__0 */
</pre>
<p>the filename in /var in this comment is not correct anymore</p>

<hr>

<p>In <a href="https://github.com/geany/geany/pull/2222#discussion_r308014905">src/socket.c</a>:</p>
<pre style='color:#555'>> -     * 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.
+        * If that fails, we try to use /tmp as a fallback. The last resort
+        * is the configuration directory. But the other directories
+        * are preferred in case the configuration directory is located on
+        * a network file system or any other file system which doesn't
+        * support sockets (see #1888561). Append a random int to
+        * prevent clashes with other instances on the system. */
+       real_dir = g_build_filename(g_get_user_runtime_dir(), "geany", NULL);
+       val = utils_mkdir(real_dir, FALSE);
</pre>
<p>ideally you'd increase the cope of the <code>saved_errno</code> variables en use that as it's a better variable name.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/geany/geany/pull/2222?email_source=notifications&email_token=AAIOWJ22JHULNLGIPTK7M7DQBXYR7A5CNFSM4IE3PHAKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB7Y4XAI#pullrequestreview-267504513">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAIOWJ2MJ6RCEWTBOVSMH33QBXYR7ANCNFSM4IE3PHAA">mute the thread</a>.<img src="https://github.com/notifications/beacon/AAIOWJ2DNEF2ESA5E53ZNUTQBXYR7A5CNFSM4IE3PHAKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB7Y4XAI.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/geany/geany/pull/2222?email_source=notifications\u0026email_token=AAIOWJ22JHULNLGIPTK7M7DQBXYR7A5CNFSM4IE3PHAKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB7Y4XAI#pullrequestreview-267504513",
"url": "https://github.com/geany/geany/pull/2222?email_source=notifications\u0026email_token=AAIOWJ22JHULNLGIPTK7M7DQBXYR7A5CNFSM4IE3PHAKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB7Y4XAI#pullrequestreview-267504513",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>