diff options
author | Tobias Kortkamp <git@tobik.me> | 2016-02-02 09:36:39 +0100 |
---|---|---|
committer | Tobias Kortkamp <git@tobik.me> | 2016-02-02 09:36:39 +0100 |
commit | b2575d746a0398c79ed3d34b7f2126472bfb574e (patch) | |
tree | 951347e6bce15517fd7c01b9a4ac2a4ee090270d /source | |
parent | 5378ec91b5fc740df54f2d1da45968e57acb4feb (diff) |
Use correct namelen when connecting to i3 socket
Diffstat (limited to 'source')
-rw-r--r-- | source/i3-support.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/source/i3-support.c b/source/i3-support.c index f8bd3ea0..278d5f72 100644 --- a/source/i3-support.c +++ b/source/i3-support.c @@ -50,7 +50,7 @@ char *i3_socket_path = NULL; void i3_support_focus_window ( Window id ) { i3_ipc_header_t head; - int s, len; + int s; ssize_t t; struct sockaddr_un remote; size_t upm = sizeof ( remote.sun_path ); @@ -68,9 +68,8 @@ void i3_support_focus_window ( Window id ) remote.sun_family = AF_UNIX; g_strlcpy ( remote.sun_path, i3_socket_path, upm ); - len = strlen ( remote.sun_path ) + sizeof ( remote.sun_family ); - if ( connect ( s, ( struct sockaddr * ) &remote, len ) == -1 ) { + if ( connect ( s, ( struct sockaddr * ) &remote, sizeof ( struct sockaddr_un ) ) == -1 ) { fprintf ( stderr, "Failed to connect to I3 (%s): %s\n", i3_socket_path, strerror ( errno ) ); close ( s ); return; |