From: Vladimir V. Melnikov Date: Mon, 23 Mar 2009 08:22:01 +0000 (+0100) Subject: src/liboping.c: Added compatibility with old Solaris versions. X-Git-Tag: liboping-1.1.1~6 X-Git-Url: https://git.octo.it/?p=liboping.git;a=commitdiff_plain;h=0e9d92782a382cd92bcc4c851ba2a540cf5c12e4 src/liboping.c: Added compatibility with old Solaris versions. Apparently the X/Open conforming `recvmsg' function is in the `xnet' library. Check for this library and use it if it exists. Also set the ominous MSG_XPG4_2 flag. Didn't find out what it does, but apparently it's a Solaris internal flag.. --- diff --git a/configure.ac b/configure.ac index 5b72c13..c615379 100644 --- a/configure.ac +++ b/configure.ac @@ -169,6 +169,14 @@ AC_CHECK_FUNCS(socket, [], AC_MSG_ERROR(cannot find socket))) AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes") +with_libxnet="no" +AC_CHECK_LIB(xnet, __xnet_recvmsg, [with_libxnet="yes"],[]) +if test "x$with_libxnet" = "xyes" +then + CFLAGS="$CFLAGS -D_XPG4_2 -D__EXTENSIONS__" +fi +AM_CONDITIONAL(BUILD_WITH_LIBXNET, test "x$with_libxnet" = "xyes") + nanosleep_needs_rt="no" AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, diff --git a/src/liboping.c b/src/liboping.c index 4f7d955..47c8279 100644 --- a/src/liboping.c +++ b/src/liboping.c @@ -454,6 +454,9 @@ static int ping_receive_one (int fd, pinghost_t *ph, struct timeval *now) msghdr.msg_controllen = sizeof (control_buffer); /* flags; this is an output only field.. */ msghdr.msg_flags = 0; +#ifdef MSG_XPG4_2 + msghdr.msg_flags |= MSG_XPG4_2; +#endif payload_buffer_len = recvmsg (fd, &msghdr, /* flags = */ 0); if (payload_buffer_len < 0)