projects
/
connman
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
83b0c14
)
Check for socket errors and cancel gracefully
author
Marcel Holtmann
<marcel@holtmann.org>
Thu, 26 Mar 2009 00:04:31 +0000
(17:04 -0700)
committer
Marcel Holtmann
<marcel@holtmann.org>
Thu, 26 Mar 2009 00:04:31 +0000
(17:04 -0700)
plugins/dnsproxy.c
patch
|
blob
|
history
diff --git
a/plugins/dnsproxy.c
b/plugins/dnsproxy.c
index
66d608c
..
84ad596
100644
(file)
--- a/
plugins/dnsproxy.c
+++ b/
plugins/dnsproxy.c
@@
-94,10
+94,17
@@
static struct server_data *find_server(const char *interface,
static gboolean server_event(GIOChannel *channel, GIOCondition condition,
gpointer user_data)
{
static gboolean server_event(GIOChannel *channel, GIOCondition condition,
gpointer user_data)
{
+ struct server_data *data = user_data;
struct request_data *req;
unsigned char buf[768];
int sk, err, len;
struct request_data *req;
unsigned char buf[768];
int sk, err, len;
+ if (condition & (G_IO_NVAL | G_IO_ERR | G_IO_HUP)) {
+ connman_error("Error with server channel");
+ data->watch = 0;
+ return FALSE;
+ }
+
sk = g_io_channel_unix_get_fd(channel);
len = recv(sk, buf, sizeof(buf), 0);
sk = g_io_channel_unix_get_fd(channel);
len = recv(sk, buf, sizeof(buf), 0);
@@
-325,6
+332,12
@@
static gboolean listener_event(GIOChannel *channel, GIOCondition condition,
socklen_t size = sizeof(sin);
int sk, err, len;
socklen_t size = sizeof(sin);
int sk, err, len;
+ if (condition & (G_IO_NVAL | G_IO_ERR | G_IO_HUP)) {
+ connman_error("Error with listener channel");
+ listener_watch = 0;
+ return FALSE;
+ }
+
sk = g_io_channel_unix_get_fd(channel);
memset(&sin, 0, sizeof(sin));
sk = g_io_channel_unix_get_fd(channel);
memset(&sin, 0, sizeof(sin));