Code

src/liboping.c: Added compatibility with old Solaris versions.
authorVladimir V. Melnikov <wlad.w.m@gmail.com>
Mon, 23 Mar 2009 08:22:01 +0000 (09:22 +0100)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Mon, 23 Mar 2009 08:22:01 +0000 (09:22 +0100)
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..

configure.ac
src/liboping.c

index 5b72c133c6b3dadf05b06e754e2767e03a15e7b7..c6153792d7616d9b5cf175f277837e6a854ef395 100644 (file)
@@ -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,
index 4f7d955a6ad5baab241f46f12d636b0c7df22244..47c8279f2d42e2582439f57a71a90b587542c4d1 100644 (file)
@@ -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)