Hi all,

I was testng quickly a build on Solaris 10 and 11 and was wondering if this
fix made sense ?

Thanks in advance.

Kind regards.
From c2a10dc311c5ee353d0041eff04dbd10b74a6c3b Mon Sep 17 00:00:00 2001
From: David Carlier <devne...@gmail.com>
Date: Sat, 19 Nov 2016 19:14:26 +0000
Subject: [PATCH] BUG/MEDIUM: fix build on Solaris

- uint16_t instead of u_int16_t (only present in sys/rds.h)
- Non ISO fields of struct tm do not exist
---
 include/types/connection.h |    4 ++--
 src/server.c               |    2 +-
 src/standard.c             |   13 +++++++++----
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/include/types/connection.h b/include/types/connection.h
index beb9b89..11eff49 100644
--- a/include/types/connection.h
+++ b/include/types/connection.h
@@ -233,8 +233,8 @@ struct data_cb {
 };
 
 struct my_tcphdr {
-	u_int16_t source;
-	u_int16_t dest;
+	uint16_t source;
+	uint16_t dest;
 };
 
 /* a connection source profile defines all the parameters needed to properly
diff --git a/src/server.c b/src/server.c
index 5da95c9..f627b40 100644
--- a/src/server.c
+++ b/src/server.c
@@ -2742,7 +2742,7 @@ const char *update_server_addr_port(struct server *s, const char *addr, const ch
 	struct sockaddr_storage sa;
 	int ret, port_change_required;
 	char current_addr[INET6_ADDRSTRLEN];
-	u_int16_t current_port, new_port;
+	uint16_t current_port, new_port;
 	struct chunk *msg;
 
 	msg = get_trash_chunk();
diff --git a/src/standard.c b/src/standard.c
index 41c54ac..6b12ab8 100644
--- a/src/standard.c
+++ b/src/standard.c
@@ -55,6 +55,12 @@ int itoa_idx = 0; /* index of next itoa_str to use */
 char quoted_str[NB_QSTR][QSTR_SIZE + 1];
 int quoted_idx = 0;
 
+#if defined(sun) || defined(__sun__)
+#define SGMTOFF(tm, off) do { } while(0)
+#else
+#define SGMTOFF(tm, off) tm->tm_gmtoff = off;
+#endif
+
 /*
  * unsigned long long ASCII representation
  *
@@ -3091,7 +3097,7 @@ int parse_imf_date(const char *date, int len, struct tm *tm)
 	RET0_UNLESS(parse_expect_char(&date, &len, ' '));     /* expect SP */
 	RET0_UNLESS(parse_strcmp(&date, &len, "GMT", 3));     /* GMT = %x47.4D.54 ; "GMT", case-sensitive */
 	tm->tm_isdst = -1;
-	tm->tm_gmtoff = 0;
+	SGMTOFF(tm, 0);
 	return 1;
 }
 
@@ -3145,8 +3151,7 @@ int parse_rfc850_date(const char *date, int len, struct tm *tm)
 	RET0_UNLESS(parse_expect_char(&date, &len, ' ')); /* expect SP */
 	RET0_UNLESS(parse_strcmp(&date, &len, "GMT", 3)); /* GMT = %x47.4D.54 ; "GMT", case-sensitive */
 	tm->tm_isdst = -1;
-	tm->tm_gmtoff = 0;
-
+	SGMTOFF(tm, 0);
 	return 1;
 }
 
@@ -3180,7 +3185,7 @@ int parse_asctime_date(const char *date, int len, struct tm *tm)
 	RET0_UNLESS(parse_4digit(&date, &len, &tm->tm_year)); /* year = 4DIGIT */
 	tm->tm_year -= 1900;
 	tm->tm_isdst = -1;
-	tm->tm_gmtoff = 0;
+	SGMTOFF(tm, 0);
 	return 1;
 }
 
-- 
1.7.9.2

Reply via email to