]> arthur.barton.de Git - netatalk.git/blobdiff - etc/cnid_dbd/usockfd.c
Add some debug messages for dbpath
[netatalk.git] / etc / cnid_dbd / usockfd.c
index ceb6ff211ad6628693b18e48bb2c1fbec2925c03..f5cdea4d22fa7c7ecd80e3ff1461f0d9dfa4c8f1 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif /* HAVE_UNISTD_H */
 #include <sys/un.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <netdb.h>
-
-#ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
-#endif /* HAVE_SYS_TYPES_H */
-#ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
-#endif /* HAVE_SYS_TIME_H */
-
 
 #include <atalk/logger.h>
+#include <atalk/compat.h>
 #include "usockfd.h"
 
 #include <sys/select.h>
@@ -92,7 +85,7 @@ int tsockfd_create(char *host, char *port, int backlog)
     hints.ai_socktype = SOCK_STREAM;
 
     if ((ret = getaddrinfo(host, port, &hints, &servinfo)) != 0) {
-        LOG(log_error, logtype_default, "tsockfd_create: getaddrinfo: %s\n", gai_strerror(ret));
+        LOG(log_error, logtype_cnid, "tsockfd_create: getaddrinfo: %s\n", gai_strerror(ret));
         return 0;
     }
 
@@ -100,7 +93,7 @@ int tsockfd_create(char *host, char *port, int backlog)
     /* loop through all the results and bind to the first we can */
     for (p = servinfo; p != NULL; p = p->ai_next) {
         if ((sockfd = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) {
-            LOG(log_info, logtype_default, "tsockfd_create: socket: %s", strerror(errno));
+            LOG(log_info, logtype_cnid, "tsockfd_create: socket: %s", strerror(errno));
             continue;
         }
 
@@ -124,13 +117,13 @@ int tsockfd_create(char *host, char *port, int backlog)
             
         if (bind(sockfd, p->ai_addr, p->ai_addrlen) == -1) {
             close(sockfd);
-            LOG(log_info, logtype_default, "tsockfd_create: bind: %s\n", strerror(errno));
+            LOG(log_info, logtype_cnid, "tsockfd_create: bind: %s\n", strerror(errno));
             continue;
         }
 
         if (listen(sockfd, backlog) < 0) {
             close(sockfd);
-            LOG(log_info, logtype_default, "tsockfd_create: listen: %s\n", strerror(errno));
+            LOG(log_info, logtype_cnid, "tsockfd_create: listen: %s\n", strerror(errno));
             continue;
         }
 
@@ -139,7 +132,7 @@ int tsockfd_create(char *host, char *port, int backlog)
     }
 
     if (p == NULL)  {
-        LOG(log_error, logtype_default, "tsockfd_create: no suitable network config %s:%s", host, port);
+        LOG(log_error, logtype_cnid, "tsockfd_create: no suitable network config %s:%s", host, port);
         freeaddrinfo(servinfo);
         return -1;
     }