summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2014-09-04 12:55:53 +0200
committerKarolin Seeger <kseeger@samba.org>2014-09-08 23:19:29 +0200
commit538f62edb2cc4c17204620d8a9b3075c7453422b (patch)
treea3881226bd9936bee82d9188e854a3cd2829175e
parent6ccee19439ed2c052564624b4051d2a184b1dbb2 (diff)
downloadsamba-538f62edb2cc4c17204620d8a9b3075c7453422b.tar.gz
selftest: Fix selftest where pid is used uninitialized.
On my system this gets evaluated to 0 so in the end we detect samba to be running cause $childpid is set to 0. BUG: https://bugzilla.samba.org/show_bug.cgi?id=10793 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Thu Sep 4 17:09:17 CEST 2014 on sn-devel-104 (cherry picked from commit 6d2f56dbaf84203b351f33179cc3feaf557e0683) Signed-off-by: Andreas Schneider <asn@samba.org> Autobuild-User(v4-1-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-1-test): Mon Sep 8 23:19:29 CEST 2014 on sn-devel-104
-rw-r--r--selftest/target/Samba.pm7
1 files changed, 6 insertions, 1 deletions
diff --git a/selftest/target/Samba.pm b/selftest/target/Samba.pm
index ab3851f67e..b0817fd3d2 100644
--- a/selftest/target/Samba.pm
+++ b/selftest/target/Samba.pm
@@ -188,7 +188,12 @@ sub get_interface($)
sub cleanup_child($$)
{
my ($pid, $name) = @_;
- my $childpid = waitpid($pid, WNOHANG);
+ my $childpid = -1;
+
+ if (defined($pid)) {
+ $childpid = waitpid($pid, WNOHANG);
+ }
+
if ($childpid == 0) {
} elsif ($childpid < 0) {
printf STDERR "%s child process %d isn't here any more\n",