From 416c6fd6bff3013eebb33e68f1c648ef22e9a965 Mon Sep 17 00:00:00 2001
From: venaas <venaas>
Date: Tue, 12 Feb 2008 08:23:17 +0000
Subject: trying to support solaris9

git-svn-id: https://svn.testnett.uninett.no/radsecproxy/branches/release-1.1@209 e88ac4ed-0b26-0410-9574-a7f39faa03bf
---
 debug.c       |  2 ++
 debug.h       |  2 ++
 radsecproxy.c | 20 ++++++++++++++++++++
 3 files changed, 24 insertions(+)

diff --git a/debug.c b/debug.c
index 384c141..9d0312e 100644
--- a/debug.c
+++ b/debug.c
@@ -6,7 +6,9 @@
  * copyright notice and this permission notice appear in all copies.
  */
 
+#ifndef SYS_SOLARIS9
 #include <stdint.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
diff --git a/debug.h b/debug.h
index 79a275e..b4b8787 100644
--- a/debug.h
+++ b/debug.h
@@ -6,7 +6,9 @@
  * copyright notice and this permission notice appear in all copies.
  */
 
+#ifndef SYS_SOLARIS9
 #include <stdint.h>
+#endif
 
 #define DBG_DBG 8
 #define DBG_INFO 16
diff --git a/radsecproxy.c b/radsecproxy.c
index d4a2fc8..a4ffed8 100644
--- a/radsecproxy.c
+++ b/radsecproxy.c
@@ -34,6 +34,9 @@
 #include <netdb.h>
 #include <string.h>
 #include <unistd.h>
+#ifdef SYS_SOLARIS9
+#include <fcntl.h>
+#endif
 #include <sys/time.h>
 #include <sys/types.h>
 #include <arpa/inet.h>
@@ -2768,6 +2771,23 @@ void getargs(int argc, char **argv, uint8_t *foreground, uint8_t *pretend, uint8
     exit(1);
 }
 
+#ifdef SYS_SOLARIS9
+int daemon(int a, int b) {
+    int i;
+
+    if (fork())
+	exit(0);
+
+    setsid();
+
+    for (i = 0; i < 3; i++) {
+	close(i);
+	open("/dev/null", O_RDWR);
+    }
+    return 1;
+}
+#endif
+
 int main(int argc, char **argv) {
     pthread_t udpserverth, udpaccserverth, udpclient4rdth, udpclient6rdth;
     struct list_node *entry;
-- 
cgit v1.1