fix macos build
authorleptonyu <i@icymint.me>
Sun, 15 Mar 2020 01:39:42 +0000 (01:39 +0000)
committerleptonyu <i@icymint.me>
Sun, 15 Mar 2020 01:39:42 +0000 (01:39 +0000)
src/fd_device.c

index 8429556..eab9e16 100644 (file)
@@ -55,7 +55,11 @@ static int read_fd(int socket) {
                logger(DEBUG_ALWAYS, LOG_ERR, "Could not read from unix socket (error %d)!", ret);
                return -1;
        }
+#ifdef IP_RECVERR
        if(msg.msg_flags & (MSG_CTRUNC | MSG_OOB | MSG_ERRQUEUE)) {
+#else
+       if(msg.msg_flags & (MSG_CTRUNC | MSG_OOB)) {
+#endif
                logger(DEBUG_ALWAYS, LOG_ERR, "Error while receiving message (flags %d)!", msg.msg_flags);
                return -1;
        }
@@ -73,7 +77,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!",
-                       cmsgptr->cmsg_len, CMSG_LEN(sizeof(device_fd)));
+                       (unsigned long)cmsgptr->cmsg_len, CMSG_LEN(sizeof(device_fd)));
                return -1;
        }