From c4d379e37cdb6a221a64c3e0900f9d45c4eac726 Mon Sep 17 00:00:00 2001 From: orges Date: Tue, 22 Jul 2014 00:06:31 +0300 Subject: [PATCH] safer usage of errno --- common/common.h | 4 ++++ server/pgnosqlserver.cpp | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/common/common.h b/common/common.h index 48a8470..12e0abb 100755 --- a/common/common.h +++ b/common/common.h @@ -12,6 +12,10 @@ #include #include "exceptions/exceptions.h" +#ifndef EOK + #define EOK 0 +#endif + using namespace log4cxx; using namespace log4cxx::xml; using namespace log4cxx::helpers; diff --git a/server/pgnosqlserver.cpp b/server/pgnosqlserver.cpp index b0aaddc..a32e72b 100755 --- a/server/pgnosqlserver.cpp +++ b/server/pgnosqlserver.cpp @@ -182,6 +182,7 @@ int PgnosqlServer::run() char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV]; in_len = sizeof in_addr; + errno=EOK; infd = accept (sfd, &in_addr, &in_len); if (infd == -1) { @@ -242,7 +243,7 @@ int PgnosqlServer::run() { ssize_t count; char buf[512]; - + errno=EOK; count = read (events[i].data.fd, buf, sizeof buf); if (count == -1) {