From b619662201fea3adeff404c9b261b44191a2ae76 Mon Sep 17 00:00:00 2001 From: Erik Ekman Date: Thu, 7 Aug 2008 16:53:59 +0000 Subject: [PATCH] Patch to make it build on BeOS R5-BONE and Haiku from Francois Revol --- CHANGELOG | 2 ++ src/Makefile | 2 +- src/common.c | 12 ++++++++++++ src/osflags | 13 +++++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index aacf36a..bfdd9d7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -14,6 +14,8 @@ CHANGES: - The interval between "pings" from clients is now 5 seconds. - Eliminited extra "ping" messages from client to server when server sends data and gets data back directly. + - Applied patch to make iodine build on BeOS R5-BONE and Haiku, + from Francois Revol. Still work to do to get tun device working. 2008-08-06: 0.4.2 "Opened Zone" - Applied a few small patches from Maxim Bourmistrov and Gregor Herrmann diff --git a/src/Makefile b/src/Makefile index c397f1d..2b4a424 100644 --- a/src/Makefile +++ b/src/Makefile @@ -9,7 +9,7 @@ OS = `uname | tr "a-z" "A-Z"` ARCH = `uname -m` LDFLAGS = -lz `sh osflags link` -CFLAGS = -c -g -Wall -D$(OS) -pedantic +CFLAGS = -c -g -Wall -D$(OS) -pedantic `sh osflags cflags` all: stateos $(CLIENT) $(SERVER) diff --git a/src/common.c b/src/common.c index f738ce5..9c851dc 100644 --- a/src/common.c +++ b/src/common.c @@ -74,6 +74,14 @@ static int daemon(int nochdir, int noclose) } #endif +#if defined(__BEOS__) && !defined(__HAIKU__) +int setgroups(int count, int *groups) +{ + /* errno = ENOSYS; */ + return -1; +} +#endif + int open_dns(int localport, in_addr_t listen_ip) { @@ -113,11 +121,15 @@ close_dns(int fd) void do_chroot(char *newroot) { +#if !defined(__BEOS__) || defined(__HAIKU__) if (chroot(newroot) != 0 || chdir("/") != 0) err(1, "%s", newroot); seteuid(geteuid()); setuid(getuid()); +#else + warnx("chroot not available"); +#endif } void diff --git a/src/osflags b/src/osflags index 0f8665d..2e28ee8 100755 --- a/src/osflags +++ b/src/osflags @@ -7,8 +7,21 @@ link) SunOS | solaris) echo '-lsocket -lnsl'; ;; + BeOS) + echo '-lsocket -lbind -lbsd'; + ;; + Haiku) + echo '-lnetwork'; + ;; esac ;; +cflags) + case `uname` in + BeOS) + echo '-Dsocklen_t=int'; + ;; + esac +;; *) ;; esac