commit 30a8aaeeec4fda1bcee8fb9419bb0a924241fd67
parent 0989e87037363bc4977b23da4304c51284026a14
Author: Christoph Lohmann <20h@r-36.net>
Date:   Sat, 13 Apr 2013 21:25:04 +0200
Adding the IPv6 to the manpage.
Diffstat:
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/geomyidae.8 b/geomyidae.8
@@ -11,6 +11,8 @@
 .Sh SYNOPSIS
 .Nm
 .Bk -words
+.Op Fl 4
+.Op Fl 6
 .Op Fl d
 .Op Fl l Ar logfile
 .Op Fl v Ar loglevel
@@ -77,6 +79,12 @@ source archive.
 geomyidae options and default settings:
 .Bl -tag -width Ds
 .
+.It Fl 4
+Only use IPv4.
+.
+.It Fl 6
+Only use IPv6.
+.
 .It Fl d
 Don't fork into background
 .
diff --git a/main.c b/main.c
@@ -395,19 +395,23 @@ main(int argc, char *argv[])
 	if(bindip)
 		hints.ai_flags |= AI_CANONNAME;
 
+	listfd = -1;
 	if(v6) {
 		hints.ai_family = PF_INET6;
 		listfd = getlistenfd(&hints, bindip, port);
 		if(!v4 && listfd < 0) {
-			perror("getlistenfd");
+			perror("getlistenfd6");
 			return 1;
 		}
+		if(listfd < 0)
+			perror("getlistenfd6");
 	}
-	if(v4) {
+	if(v4 && listfd < 0) {
+		printf("In v4\n");
 		hints.ai_family = PF_INET;
 		listfd = getlistenfd(&hints, bindip, port);
 		if(listfd < 0) {
-			perror("getlistenfd");
+			perror("getlistenfd4");
 			return 1;
 		}
 	}