Remove possible '/' from display name when building socket filename

MacOS X seems to have slashes in the display name, which prevent the
socket file from being created.  So, replace such characters that may
not appear in a filename with an underscore.
This commit is contained in:
Colomban Wendling 2012-02-10 01:18:30 +01:00
parent 9426104f0b
commit 01fea3e747

View File

@ -281,8 +281,12 @@ gint socket_init(gint argc, gchar **argv)
/* these lines are taken from dcopc.c in kdelibs */
if ((p = strrchr(display_name, '.')) > strrchr(display_name, ':') && p != NULL)
*p = '\0';
while ((p = strchr(display_name, ':')) != NULL)
*p = '_';
/* remove characters that may not be acceptable in a filename */
for (p = display_name; *p; p++)
{
if (*p == ':' || *p == '/')
*p = '_';
}
if (socket_info.file_name == NULL)
socket_info.file_name = g_strdup_printf("%s%cgeany_socket_%s_%s",