diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2008-11-22 00:14:53 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2008-11-22 00:14:53 +0800 |
commit | 3ce271c0a36a688ee902360cde82762c0bceda59 (patch) | |
tree | 9c9f0cc53644a0cd8fc3c5075bf1d89342d675ef | |
parent | e63a97260e5ddd2c30d0fcb5368676d946d6200f (diff) | |
download | gsoc2013-empathy-3ce271c0a36a688ee902360cde82762c0bceda59.tar gsoc2013-empathy-3ce271c0a36a688ee902360cde82762c0bceda59.tar.gz gsoc2013-empathy-3ce271c0a36a688ee902360cde82762c0bceda59.tar.bz2 gsoc2013-empathy-3ce271c0a36a688ee902360cde82762c0bceda59.tar.lz gsoc2013-empathy-3ce271c0a36a688ee902360cde82762c0bceda59.tar.xz gsoc2013-empathy-3ce271c0a36a688ee902360cde82762c0bceda59.tar.zst gsoc2013-empathy-3ce271c0a36a688ee902360cde82762c0bceda59.zip |
Fixed _get_local_socket in empathy-file so that it calls connect(2). (Jonny Lamb)
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
svn path=/trunk/; revision=1754
-rw-r--r-- | libempathy/empathy-file.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/libempathy/empathy-file.c b/libempathy/empathy-file.c index 9a8993ddb..8313934dc 100644 --- a/libempathy/empathy-file.c +++ b/libempathy/empathy-file.c @@ -588,12 +588,30 @@ _get_local_socket (EmpathyFile *file) size_t path_len; struct sockaddr_un addr; EmpathyFilePriv *priv; + GValue *socket_path; priv = GET_PRIV (file); - if (priv->unix_socket_path == NULL) + /* TODO: This could probably be a little nicer. */ + tp_cli_dbus_properties_run_get (priv->channel, + -1, + EMP_IFACE_CHANNEL_TYPE_FILE, + "SocketPath", + &socket_path, + NULL, + NULL); + + if (priv->unix_socket_path) + g_free (priv->unix_socket_path); + + priv->unix_socket_path = g_value_dup_string (socket_path); + g_value_unset (socket_path); + + if (G_STR_EMPTY (priv->unix_socket_path)) return -1; + DEBUG ("socket path is %s", priv->unix_socket_path); + fd = socket (PF_UNIX, SOCK_STREAM, 0); if (fd < 0) return -1; @@ -604,7 +622,7 @@ _get_local_socket (EmpathyFile *file) strncpy (addr.sun_path, priv->unix_socket_path, path_len); if (connect (fd, (struct sockaddr*) &addr, - G_STRUCT_OFFSET (struct sockaddr_un, sun_path) + path_len) < 0) + sizeof (addr)) < 0) { close (fd); return -1; |