Mercurial > gnulib
changeset 14646:2482350603ac
getsockopt: avoid compiler warning
getsockopt.c: In function 'rpl_getsockopt':
getsockopt.c:51:7: warning: passing argument 4 of 'getsockopt' from
incompatible pointer type
c:\dev\msys_setup\mingw\bin\../lib/gcc/mingw32/4.5.0/../../../../include/winsock2.h:543:32:
note: expected 'char *' but argument is of type 'int *'
A simple cast works around the mingw signature lameness. If only
they had picked void* instead of char*, like POSIX says...
* lib/getsockopt.c (rpl_getsockopt): Add a cast for mingw.
Reported by Matthias Bolte.
Signed-off-by: Eric Blake <eblake@redhat.com>
author | Eric Blake <eblake@redhat.com> |
---|---|
date | Thu, 28 Apr 2011 15:24:46 -0600 |
parents | 5c448b1cba39 |
children | 4564c34c5e88 |
files | ChangeLog lib/getsockopt.c |
diffstat | 2 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Apr 27 16:38:05 2011 -0600 +++ b/ChangeLog Thu Apr 28 15:24:46 2011 -0600 @@ -1,5 +1,9 @@ 2011-04-28 Eric Blake <eblake@redhat.com> + getsockopt: avoid compiler warning + * lib/getsockopt.c (rpl_getsockopt): Add a cast for mingw. + Reported by Matthias Bolte. + tests: drop unused link dependency * modules/areadlinkat-tests (Makefile.am): Drop stale LDADD. * modules/dirent-safer-tests (Makefile.am): Likewise.
--- a/lib/getsockopt.c Wed Apr 27 16:38:05 2011 -0600 +++ b/lib/getsockopt.c Thu Apr 28 15:24:46 2011 -0600 @@ -46,7 +46,8 @@ int milliseconds_len = sizeof (int); struct timeval tv; size_t n; - r = getsockopt (sock, level, optname, &milliseconds, &milliseconds_len); + r = getsockopt (sock, level, optname, (char *) &milliseconds, + &milliseconds_len); tv.tv_sec = milliseconds / 1000; tv.tv_usec = (milliseconds - 1000 * tv.tv_sec) * 1000; n = sizeof (struct timeval);