diff --git a/src/test/kerberos/t/001_auth.pl b/src/test/kerberos/t/001_auth.pl index 0363c5f5a8..1c1fd674cf 100644 --- a/src/test/kerberos/t/001_auth.pl +++ b/src/test/kerberos/t/001_auth.pl @@ -180,7 +180,12 @@ system_or_bail $krb5kdc, '-P', $kdc_pidfile; END { - kill 'INT', `cat $kdc_pidfile` if -f $kdc_pidfile; + # take care not to change the script's exit value + my $exit_code = $?; + + kill 'INT', `cat $kdc_pidfile` if defined($kdc_pidfile) && -f $kdc_pidfile; + + $? = $exit_code; } note "setting up PostgreSQL instance"; diff --git a/src/test/ldap/t/001_auth.pl b/src/test/ldap/t/001_auth.pl index 850b28f20f..c0f2782f49 100644 --- a/src/test/ldap/t/001_auth.pl +++ b/src/test/ldap/t/001_auth.pl @@ -147,7 +147,12 @@ system_or_bail $slapd, '-f', $slapd_conf,'-s0', '-h', "$ldap_url $ldaps_url"; END { + # take care not to change the script's exit value + my $exit_code = $?; + kill 'INT', `cat $slapd_pidfile` if -f $slapd_pidfile; + + $? = $exit_code; } append_to_file($ldap_pwfile, $ldap_rootpw);