Skip to content

Commit

Permalink
Fix inet_aton("255.255.255.255") on Windows
Browse files Browse the repository at this point in the history
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Jun 23, 2014
1 parent 2c9b311 commit d8b7da1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion compat.c
Expand Up @@ -195,7 +195,16 @@ void openconnect__unsetenv(const char *name)
int openconnect__inet_aton(const char *cp, struct in_addr *addr)
{
addr->s_addr = inet_addr(cp);
return (addr->s_addr == 0xffffffff) ? 0 : 1;
#if INADDR_NONE == 0xffffffff
if (addr->s_addr != 0xffffffff)
return 0;
/* Is it an error, or was it really 255.255.255.255? */
if (!strcmp(cp, "255.255.255.255"))
return 0;
#else
#error What is your INADDR_NONE?
#endif
return 1;
}
#endif

Expand Down

0 comments on commit d8b7da1

Please sign in to comment.