View | Details | Raw Unified | Return to bug 2341 | Differences between
and this patch

Collapse All | Expand All

(-)file_not_specified_in_diff (-7 / +27 lines)
Lines 4041-4055 x11_connect_display(void) Link Here
4041
	 * connection to the real X server.
4041
	 * connection to the real X server.
4042
	 */
4042
	 */
4043
4043
4044
	/* Check if the display is from launchd. */
4045
#ifdef __APPLE__
4044
#ifdef __APPLE__
4046
	if (strncmp(display, "/tmp/launch", 11) == 0) {
4045
	/* Check if display is a path to a socket (as set by launchd). */
4047
		sock = connect_local_xsocket_path(display);
4046
	{
4048
		if (sock < 0)
4047
		char path[PATH_MAX];
4049
			return -1;
4048
		struct stat sbuf;
4049
		int is_path_to_socket = 0;
4050
4051
		strlcpy(path, display, sizeof(path));
4052
		if (0 == stat(path, &sbuf)) {
4053
			is_path_to_socket = 1;
4054
		} else {
4055
			char *dot = strrchr(path, '.');
4056
			if (dot) {
4057
				*dot = '\0';
4058
				if (0 == stat(path, &sbuf)) {
4059
					is_path_to_socket=1;
4060
				}
4061
			}
4062
		}
4050
4063
4051
		/* OK, we now have a connection to the display. */
4064
		if (is_path_to_socket) {
4052
		return sock;
4065
			/* Create a socket. */
4066
			sock = connect_local_xsocket_path(path);
4067
			if (sock < 0)
4068
				return -1;
4069
4070
			/* OK, we now have a connection to the display. */
4071
			return sock;
4072
		}
4053
	}
4073
	}
4054
#endif
4074
#endif
4055
	/*
4075
	/*

Return to bug 2341