Commit 21fc4ee9 authored by Niels Möller's avatar Niels Möller
Browse files

* io.c: Include lsh headers *before* system headers.

Use jpoll.h, not poll.h.

* io.c: (get_inaddr): Use inet_aton. How portable is that?

Rev: src/io.c:1.38
parent 23d7bef1
...@@ -23,6 +23,11 @@ ...@@ -23,6 +23,11 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include "io.h"
#include "werror.h"
#include "write_buffer.h"
#include "xalloc.h"
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
...@@ -31,7 +36,7 @@ ...@@ -31,7 +36,7 @@
#ifdef HAVE_POLL #ifdef HAVE_POLL
#include <poll.h> #include <poll.h>
#else #else
#include "poll.h" #include "jpoll.h"
#endif #endif
#include <errno.h> #include <errno.h>
...@@ -41,11 +46,6 @@ ...@@ -41,11 +46,6 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <signal.h> #include <signal.h>
#include "io.h"
#include "werror.h"
#include "write_buffer.h"
#include "xalloc.h"
#define CLASS_DEFINE #define CLASS_DEFINE
#include "io.h.x" #include "io.h.x"
#undef CLASS_DEFINE #undef CLASS_DEFINE
...@@ -479,8 +479,21 @@ get_inaddr(struct sockaddr_in * addr, ...@@ -479,8 +479,21 @@ get_inaddr(struct sockaddr_in * addr,
else else
{ {
/* First check for numerical ip-number */ /* First check for numerical ip-number */
#if 1
/* FIXME: How portable is inet_aton? */
if (!inet_aton(host, addr))
#else
/* TODO: It is wrong to work with ((unsigned long int) -1)
* directly, as this breaks Linux/Alpha systems. But
* INADDR_NONE isn't portable. The clean solution is to use
* inet_aton rather than inet_addr; see the GNU libc
* documentation. */
#ifndef INADDR_NONE
#define INADDR_NONE ((unsigned long int) -1)
#endif
addr->sin_addr.s_addr = inet_addr(host); addr->sin_addr.s_addr = inet_addr(host);
if (addr->sin_addr.s_addr == INADDR_NONE) if (addr->sin_addr.s_addr == INADDR_NONE)
#endif
{ {
struct hostent * hp; struct hostent * hp;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment