From 01fea3e7470756b51d1616e9b732a641f500de1b Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Fri, 10 Feb 2012 01:18:30 +0100 Subject: [PATCH] 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. --- src/socket.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/socket.c b/src/socket.c index 82fd029f5..860a0ce8e 100644 --- a/src/socket.c +++ b/src/socket.c @@ -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",