X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=test%2Flib%2FConnection.cpp;h=806ce502e4f36889ee51c4aa9954c07328da1621;hb=24f797294aca130e70317003f4ee42540429ec63;hp=05440723455bfc787caba43a18cb78c800560447;hpb=7e2b466107a65e22f1cc258ca8643922dbb60352;p=awesomized%2Flibmemcached diff --git a/test/lib/Connection.cpp b/test/lib/Connection.cpp index 05440723..806ce502 100644 --- a/test/lib/Connection.cpp +++ b/test/lib/Connection.cpp @@ -2,15 +2,20 @@ #include #include -#include -#include +#if HAVE_UNISTD_H +# include +#endif + +#if !(HAVE_SOCK_NONBLOCK && HAVE_SOCK_CLOEXEC) +# include +# define SOCK_NONBLOCK O_NONBLOCK +# define SOCK_CLOEXEC O_CLOEXEC +#endif static inline int socket_ex(int af, int so, int pf, int fl) { #if HAVE_SOCK_NONBLOCK && HAVE_SOCK_CLOEXEC return socket(af, so | fl, pf); #else -# define SOCK_NONBLOCK O_NONBLOCK -# define SOCK_CLOEXEC O_CLOEXEC auto sock = socket(af, so, pf); if (0 <= sock) { if (0 > fcntl(sock, F_SETFL, fl | fcntl(sock, F_GETFL))) { @@ -186,10 +191,9 @@ bool Connection::open() { string Connection::error(const initializer_list &args) { stringstream ss; - for (auto &arg : args) { + for (const auto &arg : args) { ss << arg; } - cerr << ss.str() << endl; return ss.str(); }