diff options
author | Harald Welte <laforge@netfilter.org> | 2009-12-24 13:35:18 +0100 |
---|---|---|
committer | Harald Welte <laforge@netfilter.org> | 2009-12-24 13:35:18 +0100 |
commit | fb33957405ea342ef81d307e1da983cedc5f1960 (patch) | |
tree | d1f301b705d5cb4949308539f0356641309c9a7b /openbsc/src | |
parent | e98d4278d0cf87c8e2345900d612bbbb607635a0 (diff) |
properly check for EAGAIN in recv() calls
If recv() has no more messages on a non-blocking socket, errno will be EAGAIN,
not the return value!
Diffstat (limited to 'openbsc/src')
-rw-r--r-- | openbsc/src/input/ipaccess.c | 4 | ||||
-rw-r--r-- | openbsc/src/ipaccess/ipaccess-proxy.c | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/openbsc/src/input/ipaccess.c b/openbsc/src/input/ipaccess.c index 4396269db..c72176657 100644 --- a/openbsc/src/input/ipaccess.c +++ b/openbsc/src/input/ipaccess.c @@ -270,8 +270,8 @@ struct msgb *ipaccess_read_msg(struct bsc_fd *bfd, int *error) hh = (struct ipaccess_head *) msg->data; ret = recv(bfd->fd, msg->data, 3, 0); if (ret < 0) { - if (ret != -EAGAIN) - LOGP(DINP, LOGL_ERROR, "recv error %s\n", strerror(errno)); + if (errno != EAGAIN) + LOGP(DINP, LOGL_ERROR, "recv error %d %s\n", ret, strerror(errno)); msgb_free(msg); *error = ret; return NULL; diff --git a/openbsc/src/ipaccess/ipaccess-proxy.c b/openbsc/src/ipaccess/ipaccess-proxy.c index 61c3c5b75..d018b6ebd 100644 --- a/openbsc/src/ipaccess/ipaccess-proxy.c +++ b/openbsc/src/ipaccess/ipaccess-proxy.c @@ -321,8 +321,8 @@ static int handle_udp_read(struct bsc_fd *bfd) hh = (struct ipaccess_head *) msg->data; ret = recv(bfd->fd, msg->data, msg->data_len, 0); if (ret < 0) { - if (ret != -EAGAIN) - DEBUGP(DINP, "recv error %s\n", strerror(errno)); + if (errno != EAGAIN) + LOGP(DINP, LOGL_ERROR, "recv error %s\n", strerror(errno)); msgb_free(msg); return ret; } @@ -635,7 +635,7 @@ struct msgb *ipaccess_read_msg(struct bsc_fd *bfd, int *error) hh = (struct ipaccess_head *) msg->data; ret = recv(bfd->fd, msg->data, 3, 0); if (ret < 0) { - if (ret != -EAGAIN) + if (errno != EAGAIN) LOGP(DINP, LOGL_ERROR, "recv error: %s\n", strerror(errno)); msgb_free(msg); *error = ret; |