selftest/s4: don't put pcap file in / by default
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Sat, 7 Dec 2019 09:48:42 +0000 (22:48 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 4 Feb 2020 05:13:40 +0000 (05:13 +0000)
If the SOCKET_WRAPPER_PCAP_DIR is not defined, let's assume it wasn't
wanted rather than choosing /.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
selftest/target/Samba4.pm

index 91e0878681a6c7ae0ad35002768b16bd685657ed..e1e3af16e3753b46182a55753070ba5dd774f602 100755 (executable)
@@ -323,10 +323,14 @@ sub setup_dns_hub_internal($$$)
                FULL_CMD => [ @full_cmd ],
                LOG_FILE => $env->{DNS_HUB_LOG},
                TEE_STDOUT => 1,
-               PCAP_FILE => "$ENV{SOCKET_WRAPPER_PCAP_DIR}/env-$hostname$.pcap",
                ENV_VARS => {},
        };
 
+       my $pcap_dir = $ENV{SOCKET_WRAPPER_PCAP_DIR};
+       if (defined $pcap_dir) {
+               $daemon_ctx->{PCAP_FILE} = "$pcap_dir/env-$hostname$.pcap",
+       }
+
        # use a pipe for stdin in the child processes. This allows
        # those processes to monitor the pipe for EOF to ensure they
        # exit when the test script exits