From 6ffdb72a4df3c06f56d594fdd56cce69c1ef664c Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 28 Dec 2009 22:03:42 +0000 Subject: [PATCH] libs/nixio: fix compile on OS X --- libs/nixio/Makefile | 8 +++++++- libs/nixio/src/splice.c | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/libs/nixio/Makefile b/libs/nixio/Makefile index f70f75421..c65822f08 100644 --- a/libs/nixio/Makefile +++ b/libs/nixio/Makefile @@ -10,8 +10,14 @@ AXTLS_VERSION = 1.2.1 AXTLS_DIR = axTLS AXTLS_FILE = $(AXTLS_DIR)-$(AXTLS_VERSION).tar.gz NIXIO_TLS ?= openssl -NIXIO_LDFLAGS = -lcrypt NIXIO_SO = nixio.so +NIXIO_LDFLAGS = + +ifeq (,$(findstring Darwin,$(OS))) + NIXIO_LDFLAGS += -lcrypt +else + EXTRA_CFLAGS += -D__DARWIN__ +endif NIXIO_OBJ = src/nixio.o src/socket.o src/sockopt.o src/bind.o src/address.o \ src/poll.o src/io.o src/file.o src/splice.o src/process.o src/syslog.o \ diff --git a/libs/nixio/src/splice.c b/libs/nixio/src/splice.c index 8b4f2a1ac..4f7c04301 100644 --- a/libs/nixio/src/splice.c +++ b/libs/nixio/src/splice.c @@ -143,7 +143,11 @@ static int nixio_sendfile(lua_State *L) { const off_t offset = lseek(infd, 0, SEEK_CUR); do { +#ifdef __DARWIN__ + r = sendfile(infd, sock, offset, len, NULL, 0); +#else r = sendfile(infd, sock, offset, len, NULL, &spliced, 0); +#endif } while (r == -1 && errno == EINTR); if (r == -1) { -- 2.25.1