summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Habets <habets@google.com>2021-11-30 12:10:25 +0000
committerThomas Habets <habets@google.com>2021-11-30 12:10:25 +0000
commitfe93525db89db289178f2dbbfad92d7a88c8226a (patch)
tree74d493c4869a08dbff9c41dadfdf0108b50d62c0
parent3cad228fddc547637570b7f16090e57e4b507027 (diff)
downloadarping-fe93525db89db289178f2dbbfad92d7a88c8226a.tar.gz
Don't attempt to use caps if header doesn't exist
Termux with android seems to not provide capabilities.h, even though the libc provides it. Without the header it's not actually possible to use it though, so don't even try. There's a similar situation with getrandom(), but it's still possible to call it without a prototype, so I'm opting to just let that spit out a warning at build time on those systems. Bug #49
-rw-r--r--src/arping.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/arping.c b/src/arping.c
index 5e21303..ab928aa 100644
--- a/src/arping.c
+++ b/src/arping.c
@@ -109,6 +109,13 @@
#if HAVE_SYS_CAPABILITY_H
#include <sys/capability.h>
+#else
+// It seems that some environments have a libc with cap_init, but do not have
+// the header files. Without the header files we won't have the cap_t struct, so
+// it won't actually work.
+//
+// TODO: Probably this logic should be in configure.ac instead.
+#undef HAVE_CAP_INIT
#endif
#if HAVE_NET_BPF_H