summarylogtreecommitdiffstats
path: root/ldns.patch
blob: b3a83e1f91e5f0ba1e926a6012a3ca45f92643b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
diff -wbBur gresolver-0.0.5/gresolver.pl gresolver-0.0.5.my/gresolver.pl
--- gresolver-0.0.5/gresolver.pl	2006-01-30 23:54:10.000000000 +0300
+++ gresolver-0.0.5.my/gresolver.pl	2013-03-11 14:35:30.336586368 +0400
@@ -63,7 +63,7 @@
 	$DIG = $OPTIONS->{dig};
 
 } else {
-	chomp($DIG = `which dig 2>/dev/null`);
+	chomp($DIG = `which drill 2>/dev/null`);
 
 }
 
@@ -410,25 +410,22 @@
 sub get_dig_version {
 	my $version;
 	# an un-argumented call to dig returns the root hints from the default server;
-	if (!open(DIG, "\"$DIG\"|")) {
+	if (!open(DIG, "\"$DIG\" -v|")) {
 		print STDERR "Cannot pipe from '$DIG': $!\n";
 		exit 1;
 
 	} else {
-		# ignore the first line:
-		<DIG>;
-		# capture the next line:
 		my $line = <DIG>;
 		close(DIG);
 
-		if ($line =~ /DiG ([\d\.]+)/) {
+		if ($line =~ /drill version ([\d\.]+) /) {
 			$version = $1;
-
-		} else {
-			print STDERR "Error parsing version output from dig, got:\n\t$line\n";
-			exit 1;
+		}
 		}
 
+	if(!defined $version) {
+			print STDERR "Error parsing version output from dig\n";
+			exit 1;
 	}
 
 	return split(/\./, $version, 3);