Don't compile support for Device=fd on platforms that do not support UNIX sockets.
[tinc] / src / fd_device.c
index 5cfe75f..cfad5af 100644 (file)
@@ -20,6 +20,7 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
+#ifdef HAVE_SYS_UN_H
 #include <sys/un.h>
 
 #include "system.h"
@@ -83,7 +84,7 @@ static int read_fd(int socket) {
 
        if(cmsgptr->cmsg_len != CMSG_LEN(sizeof(device_fd))) {
                logger(DEBUG_ALWAYS, LOG_ERR, "Wrong CMSG data length: %lu, expected %lu!",
-                      (unsigned long)cmsgptr->cmsg_len, CMSG_LEN(sizeof(device_fd)));
+                      (unsigned long)cmsgptr->cmsg_len, (unsigned long)CMSG_LEN(sizeof(device_fd)));
                return -1;
        }
 
@@ -234,3 +235,4 @@ const devops_t fd_devops = {
        .read = read_packet,
        .write = write_packet,
 };
+#endif