From 08e5cabe451b202800c1749f61a6bc62eaba6886 Mon Sep 17 00:00:00 2001 From: David Schweikert Date: Fri, 10 Feb 2017 08:27:39 +0100 Subject: [PATCH] portability fixes --- configure.ac | 2 +- src/fping.c | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index f2ea4f7..a6978e3 100644 --- a/configure.ac +++ b/configure.ac @@ -80,7 +80,7 @@ AH_BOTTOM([ ]) dnl Checks for header files. -AC_CHECK_HEADERS(unistd.h sys/file.h stdlib.h sys/select.h) +AC_CHECK_HEADERS(unistd.h sys/file.h stdlib.h sys/select.h getopt.h) AC_CONFIG_FILES([Makefile doc/Makefile diff --git a/src/fping.c b/src/fping.c index 0b958e9..ce71525 100644 --- a/src/fping.c +++ b/src/fping.c @@ -1593,14 +1593,16 @@ int receive_reply(int socket, } #if HAVE_SO_TIMESTAMP - /* ancilliary data */ - struct cmsghdr* cmsg; - for (cmsg = CMSG_FIRSTHDR(&recv_msghdr); - cmsg != NULL; - cmsg = CMSG_NXTHDR(&recv_msghdr, cmsg)) { - if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_TIMESTAMP) { - memcpy(reply_timestamp, CMSG_DATA(cmsg), sizeof(*reply_timestamp)); - timestamp_set = 1; + { + /* ancilliary data */ + struct cmsghdr* cmsg; + for (cmsg = CMSG_FIRSTHDR(&recv_msghdr); + cmsg != NULL; + cmsg = CMSG_NXTHDR(&recv_msghdr, cmsg)) { + if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_TIMESTAMP) { + memcpy(reply_timestamp, CMSG_DATA(cmsg), sizeof(*reply_timestamp)); + timestamp_set = 1; + } } } #endif