marsadm: safeguard unnecessary template file generation

This commit is contained in:
Thomas Schoebel-Theuer 2019-02-06 08:26:19 +01:00 committed by Thomas Schoebel-Theuer
parent 835fb864c3
commit 9440d2b5e8

View File

@ -377,9 +377,10 @@ sub instantiate_systemd_unit {
$text = subst_systemd_vars(0, $cmd, $res, $text);
if (open(IN, "< $outfile")) {
# Check whether something has changed
local $/; # slurp
my $old = <IN>;
close(IN);
if ($old eq $text) {
if (defined($old) && $old eq $text) {
lprint "== systemd unit '$outfile' has not changed\n" if $verbose;
return (0, $outfile);
}