selftest: Ensure that if the SAMBA_PID is not set, that the env is not OK
authorAndrew Bartlett <abartlet@samba.org>
Mon, 7 Dec 2015 00:32:25 +0000 (13:32 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 17 Dec 2015 05:27:14 +0000 (06:27 +0100)
This ensures that we must instead start the selftest environment, it is not already running

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Dec 17 06:27:14 CET 2015 on sn-devel-104

selftest/target/Samba4.pm

index cfa9f67c4016cb36e2c2dcd4c475ae8ef986fb88..fbefda7fb640303dd245ac4abe09f4ce101d9028 100755 (executable)
@@ -2016,14 +2016,19 @@ sub check_env($$)
        my ($self, $envvars) = @_;
        my $samba_pid = $envvars->{SAMBA_PID};
 
-       return 1 if $samba_pid == -1;
+       if (not defined($samba_pid)) {
+           return 0;
+       } elsif ($samba_pid > 0) {
+           my $childpid = Samba::cleanup_child($samba_pid, "samba");
 
-       my $childpid = Samba::cleanup_child($samba_pid, "samba");
-
-       if ($childpid == 0) {
+           if ($childpid == 0) {
+               return 1;
+           }
+           return 0;
+       } else {
            return 1;
        }
-       return 0;
+
 }
 
 sub setup_env($$$)