]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: fix build on Solaris 10/11
authorDavid Carlier <devnexen@gmail.com>
Sun, 20 Nov 2016 10:42:38 +0000 (10:42 +0000)
committerWilly Tarreau <w@1wt.eu>
Tue, 22 Nov 2016 11:04:19 +0000 (12:04 +0100)
uint16_t instead of u_int16_t
None ISO fields of struct tm are not present, but
by zeroyfing it, on GNU and BSD systems tm_gmtoff
field will be set.

[wt: moved the memset into each of the date functions]

include/types/connection.h
src/server.c
src/standard.c

index beb9b898e2cd35fb7d74feb12bd58f0406f6d219..11eff490c418513d5a7c194d0ffb297b33a0e37d 100644 (file)
@@ -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
index 5da95c999495563dca9c76530541cfada566c970..f627b40ab12ad4928a387dd3d21304e6d0115c98 100644 (file)
@@ -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();
index 41c54acfd2757e9711974e0744552a70d723aa89..afb2c836e2ce417e6f1974dc432f28914c626fd5 100644 (file)
@@ -3077,6 +3077,9 @@ static inline int parse_http_time(const char **date, int *len, struct tm *tm)
  */
 int parse_imf_date(const char *date, int len, struct tm *tm)
 {
+       /* tm_gmtoff, if present, ought to be zero'ed */
+       memset(tm, 0, sizeof(*tm));
+
        RET0_UNLESS(parse_http_dayname(&date, &len, tm));     /* day-name */
        RET0_UNLESS(parse_expect_char(&date, &len, ','));     /* expect "," */
        RET0_UNLESS(parse_expect_char(&date, &len, ' '));     /* expect SP */
@@ -3091,7 +3094,6 @@ 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;
        return 1;
 }
 
@@ -3108,6 +3110,9 @@ int parse_rfc850_date(const char *date, int len, struct tm *tm)
 {
        int year;
 
+       /* tm_gmtoff, if present, ought to be zero'ed */
+       memset(tm, 0, sizeof(*tm));
+
        RET0_UNLESS(parse_http_ldayname(&date, &len, tm));    /* Read the day name */
        RET0_UNLESS(parse_expect_char(&date, &len, ','));     /* expect "," */
        RET0_UNLESS(parse_expect_char(&date, &len, ' '));     /* expect SP */
@@ -3145,7 +3150,6 @@ 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;
 
        return 1;
 }
@@ -3163,6 +3167,9 @@ int parse_rfc850_date(const char *date, int len, struct tm *tm)
  */
 int parse_asctime_date(const char *date, int len, struct tm *tm)
 {
+       /* tm_gmtoff, if present, ought to be zero'ed */
+       memset(tm, 0, sizeof(*tm));
+
        RET0_UNLESS(parse_http_dayname(&date, &len, tm));   /* day-name */
        RET0_UNLESS(parse_expect_char(&date, &len, ' '));   /* expect SP */
        RET0_UNLESS(parse_http_monthname(&date, &len, tm)); /* expect month */
@@ -3180,7 +3187,6 @@ 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;
        return 1;
 }