Add a check for IFADDR_NONE (Solaris doesn't have it; the man page for
inet_addr() says that it returns -1 upon failure). This commit was SVN r5058.
Этот коммит содержится в:
родитель
ff0941763c
Коммит
c71d0d8bee
12
configure.ac
12
configure.ac
@ -946,7 +946,8 @@ AC_CHECK_HEADERS([alloca.h aio.h arpa/inet.h dirent.h dlfcn.h execinfo.h \
|
||||
sys/stat.h poll.h pthread.h pwd.h sched.h stdint.h string.hstrings.h stropts.h \
|
||||
sys/types.h sys/ipc.h sys/mman.h sys/resource.h sys/select.h sys/socket.h \
|
||||
sys/ioctl.h err.h sys/statvfs.h sys/time.h sys/uio.h sys/utsname.h sys/wait.h \
|
||||
syslog.h termios.h ulimit.h unistd.h sys/param.h sys/tree.h sys/queue.h])
|
||||
syslog.h termios.h ulimit.h unistd.h sys/param.h sys/tree.h sys/queue.h \
|
||||
sys/sockio.h])
|
||||
|
||||
# snprintf declaration
|
||||
# gethostname declaration
|
||||
@ -974,6 +975,15 @@ AC_DEFINE_UNQUOTED(OMPI_HAVE_SA_LEN, $VALUE,
|
||||
[Whether we have the sa_len struct in <sys/socket.h> or not])
|
||||
AC_MSG_RESULT([$MSG])
|
||||
|
||||
# IFADDR_NONE
|
||||
AC_MSG_CHECKING([for INADDR_NONE])
|
||||
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT]],
|
||||
[[unsigned long inaddr = INADDR_NONE;]]),
|
||||
[MSG=yes VALUE=1], [MSG=no VALUE=0])
|
||||
AC_DEFINE_UNQUOTED(OMPI_HAVE_INADDR_NONE, $VALUE,
|
||||
[Whether we have INADDR_NONE constant or not])
|
||||
AC_MSG_RESULT([$MSG])
|
||||
|
||||
# union semun in sys/sem.h
|
||||
|
||||
# Note that sometimes we have <stdbool.h>, but it doesn't work (e.g.,
|
||||
|
@ -26,6 +26,9 @@
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKIO_H
|
||||
#include <sys/sockio.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
@ -424,12 +427,19 @@ int ompi_ifaddrtoname(const char* if_addr, char* if_name, int length)
|
||||
inaddr = inet_addr(if_addr);
|
||||
|
||||
rc = ompi_ifinit();
|
||||
if(rc != OMPI_SUCCESS)
|
||||
if (OMPI_SUCCESS != rc) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
if(inaddr == INADDR_NONE) {
|
||||
if(
|
||||
#if OMPI_HAVE_INADDR_NONE
|
||||
INADDR_NONE == inaddr
|
||||
#else
|
||||
-1 == inaddr
|
||||
#endif
|
||||
) {
|
||||
h = gethostbyname(if_addr);
|
||||
if(h == 0) {
|
||||
if(0 == h) {
|
||||
ompi_output(0,"ompi_ifaddrtoname: unable to resolve %s\n", if_addr);
|
||||
return OMPI_ERR_NOT_FOUND;
|
||||
}
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user