]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Look for ifconfig.sh.in in testsock.pl parent dir
authorTom Krizek <tkrizek@isc.org>
Mon, 2 Jan 2023 16:54:58 +0000 (17:54 +0100)
committerTom Krizek <tkrizek@isc.org>
Fri, 13 Jan 2023 16:01:30 +0000 (17:01 +0100)
Instead of using the current working directory to find the ifconfig.sh
script, look for the ifconfig.sh.in template in the directory where the
testsock.pl script is located. This enables the testsock.pl script to be
called from any working directory.

Using the ifconfig.sh.in template is sufficient, since it contains
the necessary information to be extracted: the max= value (which is
hard-coded in the template).

bin/tests/system/testsock.pl

index 3677e200b260efa69ca41f0a31556504af7be6df..e793874d93b190ee86b6c21e67ede61c934604e0 100755 (executable)
@@ -15,6 +15,8 @@
 
 require 5.001;
 
+use Cwd 'abs_path';
+use File::Basename;
 use Socket;
 use Getopt::Long;
 
@@ -27,7 +29,8 @@ my @ids;
 if ($id != 0) {
        @ids = ($id);
 } else {
-       my $fn = "ifconfig.sh";
+       my $dir = dirname(abs_path($0));
+       my $fn = "$dir/ifconfig.sh.in";
        open FH, "< $fn" or die "open < $fn: $!\n";
        while (<FH>) {
                @ids = (1..$1)