$OpenBSD: patch-src_fping_c,v 1.4 2017/02/10 14:23:49 sthen Exp $
--- src/fping.c.orig	Thu Feb  9 09:22:25 2017
+++ src/fping.c	Fri Feb 10 14:21:23 2017
@@ -364,6 +364,9 @@ int main(int argc, char** argv)
             perror("cannot setuid");
     }
 
+    if (pledge("stdio inet rpath dns", NULL) == -1)
+        perror("pledge");
+
     ident = getpid() & 0xFFFF;
     verbose_flag = 1;
     backoff_flag = 1;
@@ -583,6 +586,11 @@ int main(int argc, char** argv)
         }
     }
 
+    if (!filename) { /* drop rpath if not reading addrs from file */
+        if (pledge("stdio inet dns", NULL) == -1)
+            perror("pledge");
+    }
+
     /* validate various option settings */
 
     if (ttl > 255) {
@@ -798,6 +806,14 @@ int main(int argc, char** argv)
         exit(num_noaddress ? 2 : 1);
     }
 
+    if (name_flag) { /* done with file, drop rpath */
+        if (pledge("stdio inet dns", NULL) == -1)
+            perror("pledge");
+    } else { /* and drop dns unless we do reverse lookups */
+        if (pledge("stdio inet", NULL) == -1)
+            perror("pledge");
+    }
+
     if (src_addr_present) {
         socket_set_src_addr(s, src_addr);
     }
@@ -1667,7 +1683,7 @@ int wait_for_reply(long wait_time)
 
 #ifndef IPV6
     ip = (struct ip*)buffer;
-#if defined(__alpha__) && __STDC__ && !defined(__GLIBC__)
+#if defined(__alpha__) && __STDC__ && !defined(__GLIBC__) && !defined(__OpenBSD__)
     /* The alpha headers are decidedly broken.
      * Using an ANSI compiler, it provides ip_vhl instead of ip_hl and
      * ip_v.  So, to get ip_hl, we mask off the bottom four bits.
