From e4394777d2f9ef5192ffdb59b658730bc95edea5 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Sat, 19 Oct 2024 16:04:36 +0200 Subject: [PATCH] tools: code-style cleanup file_set_contents Signed-off-by: Thomas Lamprecht --- src/PVE/Tools.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm index 55aac9f..b354039 100644 --- a/src/PVE/Tools.pm +++ b/src/PVE/Tools.pm @@ -290,9 +290,9 @@ sub file_set_contents { } else { # Encode wide characters with print before passing them to syswrite my $unencoded_data = $data; - open my $datafh, '>', \$data; - print $datafh $unencoded_data; - close $datafh; + open(my $data_fh, '>', \$data) or die "failed to open in-memory variable - $!\n"; + print $data_fh $unencoded_data; + close($data_fh); } my $offset = 0;