[pve-devel] [PATCH container] Add missing '\n' to content in ct_modify_file
Fabian Grünbichler
f.gruenbichler at proxmox.com
Tue Apr 5 12:22:40 CEST 2016
if the provided content is not '\n'-terminated and non-empty,
add a trailing '\n', otherwise the END marker breaks.
---
src/PVE/LXC/Setup/Base.pm | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/PVE/LXC/Setup/Base.pm b/src/PVE/LXC/Setup/Base.pm
index e1fd0f3..eefc506 100644
--- a/src/PVE/LXC/Setup/Base.pm
+++ b/src/PVE/LXC/Setup/Base.pm
@@ -522,6 +522,7 @@ sub ct_modify_file {
my $head = "# --- BEGIN PVE ---\n";
my $tail = "# --- END PVE ---\n";
my $perms = $options{perms};
+ $data .= "\n" if $data && $data !~ m/.*?\n$/;
if (!$self->ct_file_exists($file)) {
$self->ct_file_set_contents($file, $head.$data.$tail, $perms) if $data;
--
2.1.4
More information about the pve-devel
mailing list