From 271c2e2aa52dd2fc749b8c06aadf44c86ffbe205 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Mon, 27 May 2019 07:27:39 +0300 Subject: Unlink tempfile on error --- lib/Config/HAProxy.pm | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/Config/HAProxy.pm') diff --git a/lib/Config/HAProxy.pm b/lib/Config/HAProxy.pm index 44cc3fb..175e402 100644 --- a/lib/Config/HAProxy.pm +++ b/lib/Config/HAProxy.pm @@ -235,6 +235,7 @@ sub save { my ($ok, $err, $full, $outbuf, $errbuf) = run(command => "$cmd $tempfile"); unless ($ok) { + unlink $tempfile; if ($errbuf && @$errbuf) { croak "Syntax check failed: ".join("\n", @$errbuf)."\n"; } -- cgit v1.2.1