Fixed setting if IP address (ipport) that turned out negative on Solaris.
[pazpar2-moved-to-github.git] / src / pazpar2.c
index e3c3649..5047a5d 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: pazpar2.c,v 1.23 2007-01-10 10:04:23 adam Exp $ */;
+/* $Id: pazpar2.c,v 1.25 2007-01-10 10:48:27 adam Exp $ */
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -859,7 +859,8 @@ static struct connection *connection_create(struct client *cl)
 
     if (!(addr = cs_straddr(link, cl->database->host->ipport)))
     {
-        yaz_log(YLOG_WARN|YLOG_ERRNO, "Lookup of IP address failed?");
+        yaz_log(YLOG_WARN|YLOG_ERRNO, "Lookup of IP address %s failed?", 
+           cl->database->host->ipport);
         return 0;
     }
 
@@ -1015,7 +1016,7 @@ void load_simpletargets(const char *fn)
             }
             assert(addrinfo->ai_family == PF_INET);
             memcpy(addrbuf, &((struct sockaddr_in*)addrinfo->ai_addr)->sin_addr.s_addr, 4);
-            sprintf(ipport, "%hhd.%hhd.%hhd.%hhd:%s",
+            sprintf(ipport, "%u.%u.%u.%u:%s",
                     addrbuf[0], addrbuf[1], addrbuf[2], addrbuf[3], port);
             host->ipport = xstrdup(ipport);
             freeaddrinfo(addrinfo);
@@ -1400,7 +1401,7 @@ int main(int argc, char **argv)
     char *arg;
     int setport = 0;
 
-    if (signal(SIGPIPE, SIG_IGN) < 0)
+    if (signal(SIGPIPE, SIG_IGN) == SIG_ERR)
         yaz_log(YLOG_WARN|YLOG_ERRNO, "signal");
 
     yaz_log_init(YLOG_DEFAULT_LEVEL, "pazpar2", 0);