Using `0xffffffff' instead of -1 as error code for inet_addr () since on

1998-07-30  Martin Baulig  <martin@home-of-linux.org>

	* sysdeps/common/gnuslib.c: Using `0xffffffff' instead of -1
	as error code for inet_addr () since on 64bit systems,
	`inet_addr (some_error) != (INET_ADDR) -1'.
This commit is contained in:
Martin Baulig
1998-07-30 12:54:00 +00:00
committed by Martin Baulig
parent a33b97ef9d
commit 8ced0f5889
2 changed files with 8 additions and 2 deletions

View File

@@ -1,5 +1,9 @@
1998-07-30 Martin Baulig <martin@home-of-linux.org>
* sysdeps/common/gnuslib.c: Using `0xffffffff' instead of -1
as error code for inet_addr () since on 64bit systems,
`inet_addr (some_error) != (INET_ADDR) -1'.
* configure.in: Only defining guile stuff if
we really have guile.

View File

@@ -45,14 +45,14 @@ static int connect_to_internet_server __P((const char *, u_short));
/* On some systems, e.g. DGUX, inet_addr returns a 'struct in_addr'. */
#ifdef HAVE_BROKEN_INET_ADDR
#define IN_ADDR struct in_addr
#define NUMERIC_ADDR_ERROR (numeric_addr.s_addr == -1)
#define NUMERIC_ADDR_ERROR (numeric_addr.s_addr == 0xffffffff)
#else
#if (LONGBITS > 32)
#define IN_ADDR unsigned int
#else
#define IN_ADDR unsigned long
#endif
#define NUMERIC_ADDR_ERROR (numeric_addr == (IN_ADDR) -1)
#define NUMERIC_ADDR_ERROR (numeric_addr == (IN_ADDR) 0xffffffff)
#endif
#include <arpa/inet.h>
@@ -208,6 +208,8 @@ glibtop_internet_addr (host)
IN_ADDR numeric_addr; /* host address */
numeric_addr = inet_addr (host);
fprintf (stderr, "TEST: %lx - %lx\n",
(IN_ADDR) numeric_addr, (IN_ADDR) 0xffffffff);
if (!NUMERIC_ADDR_ERROR)
return numeric_addr;
else if ((hp = gethostbyname (host)) != NULL)