selftest/s4: properly initialise an empty hash
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Sat, 7 Dec 2019 09:45:47 +0000 (22:45 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 4 Feb 2020 05:13:39 +0000 (05:13 +0000)
The '%ret = {}' construction was bad because '{}' is a hash-ref, which
counts as a single scalar value, but a true hash like '%ret' must be
initialised with an even number of scalar values (usually in pairs, like
'($a => $b, $c => $d)').

I think this meant %ret was initialised as something harmless like
'(<HASH(0x55ce39781278)> => undef)'.

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 6f26d8a56f8127d7e6516da9732f1fd37a74aa7a..91e0878681a6c7ae0ad35002768b16bd685657ed 100755 (executable)
@@ -1756,7 +1756,7 @@ sub provision_rodc($$$)
 sub read_config_h($)
 {
        my ($name) = @_;
-       my %ret = {};
+       my %ret;
        open(LF, "<$name") or die("unable to read $name: $!");
        while (<LF>) {
                chomp;