diff options
author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-04-17 19:36:28 +0000 |
---|---|---|
committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-04-17 19:36:28 +0000 |
commit | f9398eaf08b49c1e8af5bc87a4b19d862ab5a4de (patch) | |
tree | 295faf10fd56644eb7c7cdbfb17c25219037648b /input/device.c | |
parent | ed805ba6dc4ab8315e6fd83ecadbe57112dc93b5 (diff) |
input: fixed io channel unref and socket close
Diffstat (limited to 'input/device.c')
-rw-r--r-- | input/device.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/input/device.c b/input/device.c index 76049ec4..24540ca1 100644 --- a/input/device.c +++ b/input/device.c @@ -520,6 +520,8 @@ static gboolean interrupt_connect_cb(GIOChannel *chan, const char *path; socklen_t len; + isk = g_io_channel_unix_get_fd(chan); + if (cond & G_IO_NVAL) { err = EHOSTDOWN; isk = -1; @@ -527,14 +529,12 @@ static gboolean interrupt_connect_cb(GIOChannel *chan, } if (cond & (G_IO_HUP | G_IO_ERR)) { - err = EINTR; - isk = -1; + err = EHOSTDOWN; error("Hangup or error on HIDP interrupt socket"); goto failed; } - isk = g_io_channel_unix_get_fd(chan); idev->hidp.intr_sock = isk; idev->hidp.idle_to = 30 * 60; /* 30 minutes */ @@ -601,7 +601,6 @@ cleanup: pending_connect_free(idev->pending_connect); idev->pending_connect = NULL; - g_io_channel_unref(chan); return FALSE; } @@ -612,6 +611,8 @@ static gboolean control_connect_cb(GIOChannel *chan, int ret, csk, err; socklen_t len; + csk = g_io_channel_unix_get_fd(chan); + if (cond & G_IO_NVAL) { err = EHOSTDOWN; csk = -1; @@ -619,14 +620,11 @@ static gboolean control_connect_cb(GIOChannel *chan, } if (cond & (G_IO_HUP | G_IO_ERR)) { - err = EINTR; - csk = -1; + err = EHOSTDOWN; error("Hangup or error on HIDP control socket"); goto failed; - } - csk = g_io_channel_unix_get_fd(chan); /* Set HID control channel */ idev->hidp.ctrl_sock = csk; @@ -652,7 +650,6 @@ static gboolean control_connect_cb(GIOChannel *chan, goto failed; } - g_io_channel_unref(chan); return FALSE; failed: @@ -664,7 +661,6 @@ failed: idev->pending_connect->msg, strerror(err)); pending_connect_free(idev->pending_connect); idev->pending_connect = NULL; - g_io_channel_unref(chan); return FALSE; } @@ -1143,6 +1139,8 @@ int l2cap_connect(bdaddr_t *src, bdaddr_t *dst, unsigned short psm, GIOFunc cb, cb(io, G_IO_OUT, data); } + g_io_channel_unref(io); + return 0; failed: |