[libvirt] [PATCH] fix mingw compilation warning

Building for mingw, I got this warning: libvirt.c:242: warning: control reaches end of non-void function Here's the fix: fix mingw compilation warning * src/libvirt.c (winsock_init) [HAVE_WINSOCK2_H]: Always return a value. diff --git a/src/libvirt.c b/src/libvirt.c index ca2675a..05a92d3 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -237,8 +237,7 @@ winsock_init (void) /* http://msdn2.microsoft.com/en-us/library/ms742213.aspx */ winsock_version = MAKEWORD (2, 2); err = WSAStartup (winsock_version, &winsock_data); - if (err != 0) - return -1; + return err == 0 ? 0 : -1; } #endif -- 1.6.0.2.588.g3102

On Thu, Oct 23, 2008 at 01:59:21PM +0200, Jim Meyering wrote:
Building for mingw, I got this warning:
libvirt.c:242: warning: control reaches end of non-void function
Here's the fix:
fix mingw compilation warning * src/libvirt.c (winsock_init) [HAVE_WINSOCK2_H]: Always return a value.
ACK Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Thu, Oct 23, 2008 at 01:59:21PM +0200, Jim Meyering wrote:
Building for mingw, I got this warning:
libvirt.c:242: warning: control reaches end of non-void function
Here's the fix:
fix mingw compilation warning * src/libvirt.c (winsock_init) [HAVE_WINSOCK2_H]: Always return a value.
neat :-) +1 Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

Jim Meyering <jim@meyering.net> wrote:
Building for mingw, I got this warning:
libvirt.c:242: warning: control reaches end of non-void function
Here's the fix:
fix mingw compilation warning * src/libvirt.c (winsock_init) [HAVE_WINSOCK2_H]: Always return a value.
diff --git a/src/libvirt.c b/src/libvirt.c index ca2675a..05a92d3 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -237,8 +237,7 @@ winsock_init (void) /* http://msdn2.microsoft.com/en-us/library/ms742213.aspx */ winsock_version = MAKEWORD (2, 2); err = WSAStartup (winsock_version, &winsock_data); - if (err != 0) - return -1; + return err == 0 ? 0 : -1; } #endif
Committed.
participants (3)
-
Daniel P. Berrange
-
Daniel Veillard
-
Jim Meyering