djgpp: Fix unused-but-set-variable warning
I chose to just hide this behind '#ifndef __DJGPP__', instead of listing
all the macro combinations where it *is* used.  That would make quite a
mess.
@@ -527,7 +527,10 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
long ret = 1;
int *ip;
bio_dgram_data *data = NULL;
+# ifndef __DJGPP__
+ /* There are currently no cases where this is used on djgpp/watt32. */
int sockopt_val = 0;
+# endif
int d_errno;
# if defined(OPENSSL_SYS_LINUX) && (defined(IP_MTU_DISCOVER) || defined(IP_MTU))
socklen_t sockopt_len; /* assume that system supporting IP_MTU is
@@ -847,22 +850,22 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
break;
# endif
case BIO_CTRL_DGRAM_SET_DONT_FRAG:
- sockopt_val = num ? 1 : 0;
-
switch (data->peer.sa.sa_family) {
case AF_INET:
# if defined(IP_DONTFRAG)
+ sockopt_val = num ? 1 : 0;
if ((ret = setsockopt(b->num, IPPROTO_IP, IP_DONTFRAG,
&sockopt_val, sizeof(sockopt_val))) < 0)
ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
"calling setsockopt()");
# elif defined(OPENSSL_SYS_LINUX) && defined(IP_MTU_DISCOVER) && defined (IP_PMTUDISC_PROBE)
- if ((sockopt_val = num ? IP_PMTUDISC_PROBE : IP_PMTUDISC_DONT),
- (ret = setsockopt(b->num, IPPROTO_IP, IP_MTU_DISCOVER,
+ sockopt_val = num ? IP_PMTUDISC_PROBE : IP_PMTUDISC_DONT;
+ if ((ret = setsockopt(b->num, IPPROTO_IP, IP_MTU_DISCOVER,
&sockopt_val, sizeof(sockopt_val))) < 0)
ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
"calling setsockopt()");
# elif defined(OPENSSL_SYS_WINDOWS) && defined(IP_DONTFRAGMENT)
+ sockopt_val = num ? 1 : 0;
if ((ret = setsockopt(b->num, IPPROTO_IP, IP_DONTFRAGMENT,
(const char *)&sockopt_val,
sizeof(sockopt_val))) < 0)
@@ -875,6 +878,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
# if OPENSSL_USE_IPV6
case AF_INET6:
# if defined(IPV6_DONTFRAG)
+ sockopt_val = num ? 1 : 0;
if ((ret = setsockopt(b->num, IPPROTO_IPV6, IPV6_DONTFRAG,
(const void *)&sockopt_val,
sizeof(sockopt_val))) < 0)
@@ -882,8 +886,8 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
"calling setsockopt()");
# elif defined(OPENSSL_SYS_LINUX) && defined(IPV6_MTUDISCOVER)
- if ((sockopt_val = num ? IP_PMTUDISC_PROBE : IP_PMTUDISC_DONT),
- (ret = setsockopt(b->num, IPPROTO_IPV6, IPV6_MTU_DISCOVER,
+ sockopt_val = num ? IP_PMTUDISC_PROBE : IP_PMTUDISC_DONT;
+ if ((ret = setsockopt(b->num, IPPROTO_IPV6, IPV6_MTU_DISCOVER,
&sockopt_val, sizeof(sockopt_val))) < 0)
ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(),
"calling setsockopt()");
