[ovs-dev] [PATCH] lib: Fix warnings

Ethan Jackson ethan at nicira.com
Thu Oct 14 22:39:34 UTC 2010


Works for me.  Do you want to include the other part of my patch as well?

diff --git a/lib/daemon.c b/lib/daemon.c
index bbcfe6a..bc28973 100644
--- a/lib/daemon.c
+++ b/lib/daemon.c
@@ -23,6 +23,7 @@
 #include <string.h>
 #include <sys/resource.h>
 #include <sys/wait.h>
+#include <sys/stat.h>
 #include <unistd.h>
 #include "command-line.h"
 #include "fatal-signal.h"

Or I can submit that with the original patch after you submit this one.

On Thu, Oct 14, 2010 at 3:14 PM, Ben Pfaff <blp at nicira.com> wrote:
> I'm appending a patch that should doesn't trigger a warning here but
> should fix yours too.  Does it work?
>
> On Thu, Oct 14, 2010 at 03:10:34PM -0700, Ethan Jackson wrote:
>> $ grep -E 'TLSv1_method|SSL_CTX_new' /usr/include/openssl/*
>> /usr/include/openssl/ssl.h:SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth);
>> /usr/include/openssl/ssl.h:const SSL_METHOD *TLSv1_method(void);
>>          /* TLSv1.0 */
>> /usr/include/openssl/ssl.h:const SSL_METHOD *DTLSv1_method(void);
>>          /* DTLSv1.0 */
>>
>> Yep!
>>
>> the openssl people are notorious for changing random stuff like this.
>>
>> Ethan
>>
>> On Thu, Oct 14, 2010 at 3:04 PM, Ben Pfaff <blp at nicira.com> wrote:
>> > Seems more likely that we have different OpenSSL.
>> >
>> > Here's what I see when I run "grep -E 'TLSv1_method|SSL_CTX_new'
>> > /usr/include/openssl/*":
>> >
>> > /usr/include/openssl/ssl.h:SSL_CTX *SSL_CTX_new(SSL_METHOD *meth);
>> > /usr/include/openssl/ssl.h:SSL_METHOD *TLSv1_method(void);              /* TLSv1.0 */
>> > /usr/include/openssl/ssl.h:SSL_METHOD *DTLSv1_method(void);             /* DTLSv1.0 */
>> >
>> > Does yours have "const" somewhere in there?
>> >
>> > On Thu, Oct 14, 2010 at 02:54:00PM -0700, Ethan Jackson wrote:
>> >> Interesting . . .  Our compilers must be fighting.
>> >>
>> >> No big deal I'll just ditch this patch.
>> >>
>> >> Ethan
>> >> On Thu, Oct 14, 2010 at 2:48 PM, Ben Pfaff <blp at nicira.com> wrote:
>> >> > On Thu, Oct 14, 2010 at 02:40:11PM -0700, Ben Pfaff wrote:
>> >> >> On Thu, Oct 14, 2010 at 02:31:31PM -0700, Ethan Jackson wrote:
>> >> >> > Fixed a couple of warnings which showed up when compiling with
>> >> >> > gcc-4.5.1
>> >> >>
>> >> >> Would you mind quoting the warnings that were fixed?  It really isn't
>> >> >> obvious to me (I mostly use GCC 4.4 at the moment).
>> >> >
>> >> > Actually with this commit applied I get new warnings:
>> >> >
>> >> >    ../lib/stream-ssl.c: In function ‘do_ssl_init’:
>> >> >    ../lib/stream-ssl.c:997: warning: passing argument 1 of ‘SSL_CTX_new’ discards qualifiers from pointer target type
>> >> >    /usr/include/openssl/ssl.h:1344: note: expected ‘struct SSL_METHOD *’ but argument is of type ‘const struct SSL_METHOD *’
>> >> >
>> >> >
>> >
>
> --8<--------------------------cut here-------------------------->8--
>
> From: Ben Pfaff <blp at nicira.com>
> Date: Thu, 14 Oct 2010 15:13:33 -0700
> Subject: [PATCH] stream-ssl: Avoid warning with recent OpenSSL.
>
> Reported-by: Ethan Jackson <ethan at nicira.com>
> ---
>  lib/stream-ssl.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/lib/stream-ssl.c b/lib/stream-ssl.c
> index 9c7533d..05ba591 100644
> --- a/lib/stream-ssl.c
> +++ b/lib/stream-ssl.c
> @@ -988,7 +988,9 @@ do_ssl_init(void)
>     SSL_library_init();
>     SSL_load_error_strings();
>
> -    method = TLSv1_method();
> +    /* New OpenSSL changed TLSv1_method() to return a "const" pointer, so the
> +     * cast is needed to avoid a warning with those newer versions. */
> +    method = (SSL_METHOD *) TLSv1_method();
>     if (method == NULL) {
>         VLOG_ERR("TLSv1_method: %s", ERR_error_string(ERR_get_error(), NULL));
>         return ENOPROTOOPT;
> --
> 1.7.1
>
>




More information about the dev mailing list