Line 0
Link Here
|
|
|
1 |
# Description: Use correct namelen when connecting to i3 socket |
2 |
# Pull Request: https://github.com/DaveDavenport/rofi/pull/330 |
3 |
--- source/i3-support.c.orig 2015-12-27 18:45:50 UTC |
4 |
+++ source/i3-support.c |
5 |
@@ -50,7 +50,7 @@ char *i3_socket_path = NULL; |
6 |
void i3_support_focus_window ( Window id ) |
7 |
{ |
8 |
i3_ipc_header_t head; |
9 |
- int s, len; |
10 |
+ int s; |
11 |
ssize_t t; |
12 |
struct sockaddr_un remote; |
13 |
size_t upm = sizeof ( remote.sun_path ); |
14 |
@@ -68,9 +68,8 @@ void i3_support_focus_window ( Window id |
15 |
|
16 |
remote.sun_family = AF_UNIX; |
17 |
g_strlcpy ( remote.sun_path, i3_socket_path, upm ); |
18 |
- len = strlen ( remote.sun_path ) + sizeof ( remote.sun_family ); |
19 |
|
20 |
- if ( connect ( s, ( struct sockaddr * ) &remote, len ) == -1 ) { |
21 |
+ if ( connect ( s, ( struct sockaddr * ) &remote, sizeof ( struct sockaddr_un ) ) == -1 ) { |
22 |
fprintf ( stderr, "Failed to connect to I3 (%s): %s\n", i3_socket_path, strerror ( errno ) ); |
23 |
close ( s ); |
24 |
return; |