提交 6ff0bb47 编写于 作者: S Shengliang Guan

TD-1090

上级 152867cb
...@@ -68,8 +68,7 @@ ELSEIF (${CMAKE_SYSTEM_NAME} MATCHES "Windows") ...@@ -68,8 +68,7 @@ ELSEIF (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
MESSAGE(STATUS "The current platform is Windows 64-bit") MESSAGE(STATUS "The current platform is Windows 64-bit")
ELSE () ELSE ()
SET(TD_WINDOWS_32 TRUE) SET(TD_WINDOWS_32 TRUE)
MESSAGE(FATAL_ERROR "The current platform is Windows 32-bit, not supported yet") MESSAGE(STATUS "The current platform is Windows 32-bit")
EXIT ()
ENDIF () ENDIF ()
ELSE() ELSE()
MESSAGE(FATAL_ERROR "The current platform is not Linux/Darwin/Windows, stop compile") MESSAGE(FATAL_ERROR "The current platform is not Linux/Darwin/Windows, stop compile")
......
...@@ -359,12 +359,12 @@ static unsigned char* ensure(printbuffer * const p, size_t needed) ...@@ -359,12 +359,12 @@ static unsigned char* ensure(printbuffer * const p, size_t needed)
} }
/* calculate new buffer size */ /* calculate new buffer size */
if (needed > (LLONG_MAX / 2)) if (needed > (LONG_MAX / 2))
{ {
/* overflow of int, use LLONG_MAX if possible */ /* overflow of int, use LLONG_MAX if possible */
if (needed <= LLONG_MAX) if (needed <= LONG_MAX)
{ {
newsize = LLONG_MAX; newsize = LONG_MAX;
} }
else else
{ {
......
...@@ -25,6 +25,7 @@ extern "C" { ...@@ -25,6 +25,7 @@ extern "C" {
#define taosSendto(sockfd, buf, len, flags, dest_addr, addrlen) sendto(sockfd, buf, len, flags, dest_addr, addrlen) #define taosSendto(sockfd, buf, len, flags, dest_addr, addrlen) sendto(sockfd, buf, len, flags, dest_addr, addrlen)
#define taosReadSocket(fd, buf, len) read(fd, buf, len) #define taosReadSocket(fd, buf, len) read(fd, buf, len)
#define taosWriteSocket(fd, buf, len) write(fd, buf, len) #define taosWriteSocket(fd, buf, len) write(fd, buf, len)
#define taosCloseSocketNoCheck(x) close(x)
#define taosCloseSocket(x) \ #define taosCloseSocket(x) \
{ \ { \
if (FD_VALID(x)) { \ if (FD_VALID(x)) { \
......
...@@ -90,6 +90,7 @@ extern "C" { ...@@ -90,6 +90,7 @@ extern "C" {
#define taosSendto(sockfd, buf, len, flags, dest_addr, addrlen) sendto((SOCKET)sockfd, buf, len, flags, dest_addr, addrlen) #define taosSendto(sockfd, buf, len, flags, dest_addr, addrlen) sendto((SOCKET)sockfd, buf, len, flags, dest_addr, addrlen)
#define taosWriteSocket(fd, buf, len) send((SOCKET)fd, buf, len, 0) #define taosWriteSocket(fd, buf, len) send((SOCKET)fd, buf, len, 0)
#define taosReadSocket(fd, buf, len) recv((SOCKET)fd, buf, len, 0) #define taosReadSocket(fd, buf, len) recv((SOCKET)fd, buf, len, 0)
#define taosCloseSocketNoCheck(fd) closesocket((SOCKET)fd)
#define taosCloseSocket(fd) closesocket((SOCKET)fd) #define taosCloseSocket(fd) closesocket((SOCKET)fd)
typedef SOCKET eventfd_t; typedef SOCKET eventfd_t;
#define eventfd(a, b) -1 #define eventfd(a, b) -1
......
...@@ -233,7 +233,7 @@ SOCKET taosOpenUdpSocket(uint32_t ip, uint16_t port) { ...@@ -233,7 +233,7 @@ SOCKET taosOpenUdpSocket(uint32_t ip, uint16_t port) {
if ((sockFd = (int)socket(AF_INET, SOCK_DGRAM, 0)) <= 2) { if ((sockFd = (int)socket(AF_INET, SOCK_DGRAM, 0)) <= 2) {
uError("failed to open udp socket: %d (%s)", errno, strerror(errno)); uError("failed to open udp socket: %d (%s)", errno, strerror(errno));
close(sockFd); taosCloseSocketNoCheck(sockFd);
return -1; return -1;
} }
...@@ -268,7 +268,7 @@ SOCKET taosOpenTcpClientSocket(uint32_t destIp, uint16_t destPort, uint32_t clie ...@@ -268,7 +268,7 @@ SOCKET taosOpenTcpClientSocket(uint32_t destIp, uint16_t destPort, uint32_t clie
if (sockFd <= 2) { if (sockFd <= 2) {
uError("failed to open the socket: %d (%s)", errno, strerror(errno)); uError("failed to open the socket: %d (%s)", errno, strerror(errno));
close(sockFd); taosCloseSocketNoCheck(sockFd);
return -1; return -1;
} }
...@@ -375,7 +375,7 @@ SOCKET taosOpenTcpServerSocket(uint32_t ip, uint16_t port) { ...@@ -375,7 +375,7 @@ SOCKET taosOpenTcpServerSocket(uint32_t ip, uint16_t port) {
if ((sockFd = (int)socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) <= 2) { if ((sockFd = (int)socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) <= 2) {
uError("failed to open TCP socket: %d (%s)", errno, strerror(errno)); uError("failed to open TCP socket: %d (%s)", errno, strerror(errno));
close(sockFd); taosCloseSocketNoCheck(sockFd);
return -1; return -1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册