[geany/geany] 01fea3: Remove possible '/' from display name when building socket filename

Colomban Wendling git-noreply at xxxxx
Thu Jul 26 00:03:18 UTC 2012


Branch:      refs/heads/document-messages
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Fri, 10 Feb 2012 00:18:30
Commit:      01fea3e7470756b51d1616e9b732a641f500de1b
             https://github.com/geany/geany/commit/01fea3e7470756b51d1616e9b732a641f500de1b

Log Message:
-----------
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.


Modified Paths:
--------------
    src/socket.c

Modified: src/socket.c
8 files changed, 6 insertions(+), 2 deletions(-)
===================================================================
@@ -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",


@@ Diff output truncated at 100000 characters. @@


--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).



More information about the Commits mailing list