Use correct error string for getaddrinfo() and getnameinfo() failures.
[srvx.git] / src / ioset.c
index 4b6225e523d967d231d33a85cdd705a34c6590f7..30eb359f816bac41731e7c093146de7326379eec 100644 (file)
@@ -134,7 +134,7 @@ ioq_grow(struct ioq *ioq) {
     return new_size - ioq->put;
 }
 
-extern struct io_engine io_engine_kqueue;
+extern struct io_engine io_engine_kevent;
 extern struct io_engine io_engine_epoll;
 extern struct io_engine io_engine_win32;
 extern struct io_engine io_engine_select;
@@ -145,9 +145,9 @@ ioset_init(void)
     if (engine) /* someone beat us to it */
         return;
 
-#if WITH_IOSET_KQUEUE
-    if (!engine && io_engine_kqueue.init())
-        engine = &io_engine_kqueue;
+#if WITH_IOSET_KEVENT
+    if (!engine && io_engine_kevent.init())
+        engine = &io_engine_kevent;
 #endif
 
 #if WITH_IOSET_EPOLL
@@ -267,8 +267,9 @@ ioset_connect(struct sockaddr *local, unsigned int sa_size, const char *peer, un
     hints.ai_family = local ? local->sa_family : 0;
     hints.ai_socktype = SOCK_STREAM;
     snprintf(portnum, sizeof(portnum), "%u", port);
-    if (getaddrinfo(peer, portnum, &hints, &ai)) {
-        log_module(MAIN_LOG, LOG_ERROR, "getaddrinfo(%s, %s) failed.", peer, portnum);
+    res = getaddrinfo(peer, portnum, &hints, &ai);
+    if (res != 0) {
+        log_module(MAIN_LOG, LOG_ERROR, "getaddrinfo(%s, %s) failed: %s.", peer, portnum, gai_strerror(res));
         return NULL;
     }
 
@@ -577,7 +578,7 @@ void
 ioset_run(void) {
     extern struct io_fd *socket_io_fd;
     struct timeval timeout;
-    time_t wakey;
+    unsigned long wakey;
 
     while (!quit_services) {
         while (!socket_io_fd)
@@ -585,7 +586,7 @@ ioset_run(void) {
 
         /* How long to sleep? (fill in select_timeout) */
         wakey = timeq_next();
-        if ((wakey - now) < 0)
+        if (wakey < now)
             timeout.tv_sec = 0;
         else
             timeout.tv_sec = wakey - now;