[openssl-dev] Fixing some warnings when compiling on non-posix systems.

Matt Caswell matt at openssl.org
Mon Jun 5 08:39:58 UTC 2017


Again with this one, please submit as a github patch.

Matt

On 04/06/17 01:35, Juan Manuel Guerrero wrote:
> I do not know if someone really cares about this, but I have compiled
> openssl-1.0.2-stable-SNAP-20170602 using the DJGPP port of gcc-7.1.0.
> The code has been configured using --strict-warnings option.  At least
> the following issues have appeared.  Using the DJGPP port of gcc means
> that the code is configured and compiled on a non-posix system thus
> macros like OPENSSL_SYS_LINUX and FIONBIO are undefined rising warnings
> like the fixed ones.  The patch is only intended to show the issue and
> how it could be fixed.
> 
> 
> Regards,
> Juan M. Guerrero
> 
> 
> 
>     * crypto/bio/bss_dgram.c (long dgram_ctrl):  warning: variable
> 'sockopt_val' set but not used [-Wunused-but-set-variable]
> 
>     * crypto/bio/b_sock.c (BIO_socket_nbio):  warning: variable 'l' set
> but not used [-Wunused-but-set-variable]
> 
> 
> 
> 
> 
> 
> 
> diff -aprNU5
> openssl-1.0.2-stable-SNAP-20170602.orig/crypto/bio/bss_dgram.c
> openssl-1.0.2-stable-SNAP-20170602/crypto/bio/bss_dgram.c
> --- openssl-1.0.2-stable-SNAP-20170602.orig/crypto/bio/bss_dgram.c   
> 2017-06-03 21:36:52 +0000
> +++ openssl-1.0.2-stable-SNAP-20170602/crypto/bio/bss_dgram.c   
> 2017-06-03 21:45:22 +0000
> @@ -492,12 +492,12 @@ static long dgram_ctrl(BIO *b, int cmd,
>  {
>      long ret = 1;
>      int *ip;
>      struct sockaddr *to = NULL;
>      bio_dgram_data *data = NULL;
> -    int sockopt_val = 0;
>  # if defined(OPENSSL_SYS_LINUX) && (defined(IP_MTU_DISCOVER) ||
> defined(IP_MTU))
> +    int sockopt_val = 0;
>      socklen_t sockopt_len;      /* assume that system supporting IP_MTU is
>                                   * modern enough to define socklen_t */
>      socklen_t addr_len;
>      union {
>          struct sockaddr sa;
> diff -aprNU5 openssl-1.0.2-stable-SNAP-20170602.orig/crypto/bio/b_sock.c
> openssl-1.0.2-stable-SNAP-20170602/crypto/bio/b_sock.c
> --- openssl-1.0.2-stable-SNAP-20170602.orig/crypto/bio/b_sock.c   
> 2017-06-01 20:51:32 +0000
> +++ openssl-1.0.2-stable-SNAP-20170602/crypto/bio/b_sock.c    2017-06-03
> 21:42:30 +0000
> @@ -949,14 +949,14 @@ int BIO_set_tcp_ndelay(int s, int on)
>  }
> 
>  int BIO_socket_nbio(int s, int mode)
>  {
>      int ret = -1;
> +# ifdef FIONBIO
>      int l;
> 
>      l = mode;
> -# ifdef FIONBIO
>      ret = BIO_socket_ioctl(s, FIONBIO, &l);
>  # endif
>      return (ret == 0);
>  }
>  #endif


More information about the openssl-dev mailing list