Patchwork [4/6] ping: fix building on older systems

login
register
mail settings
Submitter Mike Frysinger
Date Aug. 1, 2012, 3:45 p.m.
Message ID <1343835928-21541-4-git-send-email-vapier@gentoo.org>
Download mbox | patch
Permalink /patch/174478/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Mike Frysinger - Aug. 1, 2012, 3:45 p.m.
The SO_MARK define is somewhat recent (linux-2.6.25), so check for its
existence before we try to use it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 ping_common.c |    2 ++
 1 file changed, 2 insertions(+)

Patch

diff --git a/ping_common.c b/ping_common.c
index 287d0e6..6fd252d 100644
--- a/ping_common.c
+++ b/ping_common.c
@@ -486,6 +486,7 @@  void setup(int icmp_sock)
 			fprintf(stderr, "Warning: no SO_TIMESTAMP support, falling back to SIOCGSTAMP\n");
 	}
 #endif
+#ifdef SO_MARK
 	if (options & F_MARK) {
 		if (setsockopt(icmp_sock, SOL_SOCKET, SO_MARK,
 				&mark, sizeof(mark)) == -1) {
@@ -499,6 +500,7 @@  void setup(int icmp_sock)
 #endif
 		}
 	}
+#endif
 
 	/* Set some SNDTIMEO to prevent blocking forever
 	 * on sends, when device is too slow or stalls. Just put limit