git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 4/4] Use INADDR_NONE instead of -1 to check inet_addr() result

From
PRPavel Roskin <proski@gnu.org>
Date
Jun 13, 2006, 04:32 UTC
Message-ID
<20060613043233.16681.68343.stgit@dv.roinet.com>
In-Reply-To
<20060613043224.16681.98358.stgit@dv.roinet.com>
From: Pavel Roskin <proski@gnu.org>
INADDR_NONE is not equal to -1 on 64-bit systems.
Signed-off-by: Pavel Roskin <proski@gnu.org>
---
 cbtcommon/tcpsocket.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/cbtcommon/tcpsocket.c b/cbtcommon/tcpsocket.c
index a174007..f31060e 100644
--- a/cbtcommon/tcpsocket.c
+++ b/cbtcommon/tcpsocket.c
@@ -198,7 +198,7 @@ #ifdef __linux__
     memcpy(dest, &ip.s_addr, sizeof(ip.s_addr));
   }
 #else
-  if ( (*dest = inet_addr(addr_str)) != -1)
+  if ( (*dest = inet_addr(addr_str)) != INADDR_NONE)
   {
     /* nothing */
   }
Previous: Pavel Roskin
Message 4 of 4 in “Remove dependencies with absolute path”
  1. 1/4 Remove dependencies with absolute pathPavel Roskin, Jun 13, 2006
  2. 2/4 Trivial compile fix for cache.cPavel Roskin, Jun 13, 2006
  3. 3/4 Use __linux__ conditional, not LINUX.Pavel Roskin, Jun 13, 2006
  4. 4/4 Use INADDR_NONE instead of -1 to check inet_addr() resultPavel Roskin, Jun 13, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.