File 0001-add-a-safety-n-before-the-end-script-comment.patch of Package openscap.8521

From 42d973638308a67c22127c9a4daace80e7404511 Mon Sep 17 00:00:00 2001
From: Marcus Meissner <meissner@suse.de>
Date: Fri, 3 Aug 2018 16:41:19 +0200
Subject: [PATCH] add a safety \n before the end script comment.

This helps if someone uses <fix></fix> without a terminating newline
---
 src/XCCDF_POLICY/xccdf_policy_remediate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: src/XCCDF_POLICY/xccdf_policy_remediate.c
===================================================================
--- src/XCCDF_POLICY/xccdf_policy_remediate.c.orig
+++ src/XCCDF_POLICY/xccdf_policy_remediate.c
@@ -305,6 +305,11 @@ static inline int _xccdf_fix_execute(str
 		(void) close(fd);
 		goto cleanup;
 	}
+	if (_write_text_to_fd_and_free(fd, strdup("\n")) != 0) {
+		_rule_add_info_message(rr, "Could not write to the temp file: %s", strerror(errno));
+		(void) close(fd);
+		goto cleanup;
+	}
 
 	if (close(fd) != 0)
 		_rule_add_info_message(rr, "Could not close temp file: %s", strerror(errno));
@@ -513,6 +518,10 @@ static inline int _xccdf_policy_rule_gen
 		oscap_seterr(OSCAP_EFAMILY_OSCAP, "write of the fix to fd=%d failed: %s", output_fd, strerror(errno));
 		return 1;
 	}
+	if (_write_text_to_fd_and_free(output_fd, strdup("\n")) != 0) {
+		oscap_seterr(OSCAP_EFAMILY_OSCAP, "write of the fix to fd=%d failed: %s", output_fd, strerror(errno));
+		return 1;
+	}
 	return 0;
 }
openSUSE Build Service is sponsored by