Patchwork [v2] osdep: replace setsockopt by qemu_setsockopt

login
register
mail settings
Submitter Lei Li
Date March 6, 2013, 2:29 p.m.
Message ID <1362580156-11498-1-git-send-email-lilei@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/225509/
State New
Headers show

Comments

Lei Li - March 6, 2013, 2:29 p.m.
Fix the compiler warning when cross build qemu-ga
for windows by using qemu_setsockopt() instead of
setsockopt().

util/osdep.c: In function 'socket_set_nodelay':
util/osdep.c:69:5: warning: passing argument 4 of 'setsockopt' from
                   incompatible pointer type [enabled by default]
In file included from /home/lei/qemu_b/include/sysemu/os-win32.h:30:0,
                 from /home/lei/qemu_b/include/qemu-common.h:46,
                 from util/osdep.c:48:
/usr/i686-w64-mingw32/sys-root/mingw/include/winsock2.h:990:63: note:
                 expected 'const char *' but argument is of type 'int *'

Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
---

Change since v1:
  - Use qemu_setsockopt() instead of open-coding suggested by Stefan.

---
 util/osdep.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Stefan Hajnoczi - March 8, 2013, 9:22 a.m.
On Wed, Mar 06, 2013 at 10:29:16PM +0800, Lei Li wrote:
> Fix the compiler warning when cross build qemu-ga
> for windows by using qemu_setsockopt() instead of
> setsockopt().
> 
> util/osdep.c: In function 'socket_set_nodelay':
> util/osdep.c:69:5: warning: passing argument 4 of 'setsockopt' from
>                    incompatible pointer type [enabled by default]
> In file included from /home/lei/qemu_b/include/sysemu/os-win32.h:30:0,
>                  from /home/lei/qemu_b/include/qemu-common.h:46,
>                  from util/osdep.c:48:
> /usr/i686-w64-mingw32/sys-root/mingw/include/winsock2.h:990:63: note:
>                  expected 'const char *' but argument is of type 'int *'
> 
> Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
> ---
> 
> Change since v1:
>   - Use qemu_setsockopt() instead of open-coding suggested by Stefan.
> 
> ---
>  util/osdep.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)

Thanks, applied to the trivial patches tree:
https://github.com/stefanha/qemu/commits/trivial-patches

Stefan

Patch

diff --git a/util/osdep.c b/util/osdep.c
index c408261..bd59ac9 100644
--- a/util/osdep.c
+++ b/util/osdep.c
@@ -57,7 +57,7 @@  static const char *qemu_version = QEMU_VERSION;
 int socket_set_cork(int fd, int v)
 {
 #if defined(SOL_TCP) && defined(TCP_CORK)
-    return setsockopt(fd, SOL_TCP, TCP_CORK, &v, sizeof(v));
+    return qemu_setsockopt(fd, SOL_TCP, TCP_CORK, &v, sizeof(v));
 #else
     return 0;
 #endif
@@ -66,7 +66,7 @@  int socket_set_cork(int fd, int v)
 int socket_set_nodelay(int fd)
 {
     int v = 1;
-    return setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &v, sizeof(v));
+    return qemu_setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &v, sizeof(v));
 }
 
 int qemu_madvise(void *addr, size_t len, int advice)