Revision: 2247 http://geany.svn.sourceforge.net/geany/?rev=2247&view=rev Author: eht16 Date: 2008-02-10 09:55:00 -0800 (Sun, 10 Feb 2008)
Log Message: ----------- Apply patch from Daniel Richard G. to include the hostname in the socket filename (thanks).
Modified Paths: -------------- trunk/ChangeLog trunk/src/socket.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-02-10 17:53:18 UTC (rev 2246) +++ trunk/ChangeLog 2008-02-10 17:55:00 UTC (rev 2247) @@ -12,6 +12,8 @@ time stamp. Before creating a new socket, delete a maybe existing socket and its symlink. + Apply patch from Daniel Richard G. to include the hostname in the + socket filename (thanks). * src/utils.c, src/win32.c, src/win32.h: Add support for getting hostname on Windows.
Modified: trunk/src/socket.c =================================================================== --- trunk/src/socket.c 2008-02-10 17:53:18 UTC (rev 2246) +++ trunk/src/socket.c 2008-02-10 17:55:00 UTC (rev 2247) @@ -210,19 +210,26 @@ if (sock < 0) return -1; #else - gchar *display = gdk_get_display(); - gint display_num = 0; + gchar *display_name = gdk_get_display(); + gchar *hostname = utils_get_hostname(); + gchar *p;
- display = strchr(display, ':'); - if (NZV(display)) - display++; - if (NZV(display)) - display_num = atoi(display); + if (display_name == NULL) + display_name = g_strdup("NODISPLAY");
+ // 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 = '_'; + if (socket_info.file_name == NULL) - socket_info.file_name = g_strdup_printf("%s%cgeany_socket.%d", - app->configdir, G_DIR_SEPARATOR, display_num); + socket_info.file_name = g_strdup_printf("%s%cgeany_socket.%s%s", + app->configdir, G_DIR_SEPARATOR, hostname, display_name);
+ g_free(display_name); + g_free(hostname); + sock = socket_fd_connect_unix(socket_info.file_name); if (sock < 0) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.