From 29bc3d1493b8035654f2174242674d026ef13739 Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Thu, 25 Oct 2012 21:46:05 +0300 Subject: [PATCH] Fixed ERROR_IF_FUNC macro. --- common.h | 17 ++++++++--------- socket.c | 8 ++++---- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/common.h b/common.h index 7586358..b6dad7e 100644 --- a/common.h +++ b/common.h @@ -38,15 +38,14 @@ #define SECTION_FILTER_TABLE_SIZE 7 -#define ERROR_IF_FUNC(exp, errstr, func, ret) \ - do { \ - if (exp) { \ - char tmp[64]; \ - strerror_r(errno, tmp, sizeof(tmp)); \ - error(errstr": %s", tmp); \ - func; \ - ret; \ - } \ +#define ERROR_IF_FUNC(exp, errstr, func, ret) \ + do { \ + if (exp) { \ + char tmp[64]; \ + error(errstr": %s", strerror_r(errno, tmp, sizeof(tmp))); \ + func; \ + ret; \ + } \ } while (0) diff --git a/socket.c b/socket.c index 5c4b8c1..ecdf1f8 100644 --- a/socket.c +++ b/socket.c @@ -227,7 +227,7 @@ int cIptvUdpSocket::Read(unsigned char* BufferAddr, unsigned int BufferLen) //debug("cIptvUdpSocket::Read()\n"); // Error out if socket not initialized if (socketDesc <= 0) { - error("Invalid socket in %s\n", __FUNCTION__); + error("Invalid socket in cIptvUdpSocket::%s()\n", __FUNCTION__); return -1; } int len = 0; @@ -359,7 +359,7 @@ int cIptvTcpSocket::Read(unsigned char* BufferAddr, unsigned int BufferLen) //debug("cIptvTcpSocket::Read()\n"); // Error out if socket not initialized if (socketDesc <= 0) { - error("Invalid socket in %s\n", __FUNCTION__); + error("Invalid socket in cIptvTcpSocket::%s()\n", __FUNCTION__); return -1; } int len = 0; @@ -376,7 +376,7 @@ bool cIptvTcpSocket::ReadChar(char* BufferAddr, unsigned int TimeoutMs) //debug("cIptvTcpSocket::ReadChar()\n"); // Error out if socket not initialized if (socketDesc <= 0) { - error("Invalid socket in %s\n", __FUNCTION__); + error("Invalid socket in cIptvTcpSocket::%s()\n", __FUNCTION__); return false; } socklen_t addrlen = sizeof(sockAddr); @@ -401,7 +401,7 @@ bool cIptvTcpSocket::Write(const char* BufferAddr, unsigned int BufferLen) //debug("cIptvTcpSocket::Write()\n"); // Error out if socket not initialized if (socketDesc <= 0) { - error("Invalid socket in %s\n", __FUNCTION__); + error("Invalid socket in cIptvTcpSocket::%s()\n", __FUNCTION__); return false; } ERROR_IF_RET(send(socketDesc, BufferAddr, BufferLen, 0) < 0, "send()", return false);