]> git.gsnw.org Git - fping.git/commitdiff
Fix hang with '-6', with ipv6 kernel module, but not loaded
authorLonnie Abelbeck <lonnie@abelbeck.com>
Sun, 21 Oct 2018 13:47:44 +0000 (08:47 -0500)
committerLonnie Abelbeck <lonnie@abelbeck.com>
Sun, 21 Oct 2018 13:47:44 +0000 (08:47 -0500)
src/fping.c

index a4e45a1c49a19ac88255f804908d1f1b2d244095..f215a705b75f529e61187a00d8fd9651799c13a3 100644 (file)
@@ -687,11 +687,11 @@ int main(int argc, char** argv)
 
     /* validate various option settings */
 
-    if (socket4 < 0
-#ifdef IPV6
-       && socket6 < 0
+#ifndef IPV6
+    if (socket4 < 0) {
+#else
+    if ((socket4 < 0 && socket6 < 0) || (hints_ai_family == AF_INET6 && socket6 < 0)) {
 #endif
-    ) {
         crash_and_burn("can't create socket (must run as root?)");
     }