From 66e91438c5bee15c765f5ea97c9006f747d06a7f Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Tue, 6 Sep 2011 02:20:43 +0200 Subject: [PATCH] ares_process.c: fix compiler warning --- ares_process.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/ares_process.c b/ares_process.c index e5efa5fb..5de1ae62 100644 --- a/ares_process.c +++ b/ares_process.c @@ -1,6 +1,6 @@ /* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2004-2010 by Daniel Stenberg + * Copyright (C) 2004-2011 by Daniel Stenberg * * Permission to use, copy, modify, and distribute this * software and its documentation for any purpose and without @@ -837,30 +837,29 @@ static int setsocknonblock(ares_socket_t sockfd, /* operate on this */ #elif defined(HAVE_IOCTL_FIONBIO) /* older unix versions */ - int flags; - flags = nonblock; + int flags = nonblock ? 1 : 0; return ioctl(sockfd, FIONBIO, &flags); #elif defined(HAVE_IOCTLSOCKET_FIONBIO) #ifdef WATT32 - char flags; + char flags = nonblock ? 1 : 0; #else /* Windows */ - unsigned long flags; + unsigned long flags = nonblock ? 1UL : 0UL; #endif - flags = nonblock; return ioctlsocket(sockfd, FIONBIO, &flags); #elif defined(HAVE_IOCTLSOCKET_CAMEL_FIONBIO) /* Amiga */ - return IoctlSocket(sockfd, FIONBIO, (long)nonblock); + long flags = nonblock ? 1L : 0L; + return IoctlSocket(sockfd, FIONBIO, flags); #elif defined(HAVE_SETSOCKOPT_SO_NONBLOCK) /* BeOS */ - long b = nonblock ? 1 : 0; + long b = nonblock ? 1L : 0L; return setsockopt(sockfd, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b)); #else