From 8b6eb65c901ef04f9afeee60a441f7d91e7a5e9b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?=
 <bernhard.rosenkraenzer.ext@huawei.com>
Date: Fri, 3 Sep 2021 16:23:24 +0200
Subject: [PATCH] shadow: Remove -Werror=format-nonliteral from compiler flags
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

shadow uses non-literal format strings to integrate system information
into the login prompt. This is harmless because harmful format strings
are checked for (and in the worst case, the strings come from a file
that is writable by root only).

Removing -Werror=format-nonliteral here allows us to use
-Werror=format-nonliteral globally in OPTIMIZE_FOR=security mode
while keeping shadow building.

Signed-off-by: Bernhard Rosenkränzer <bernhard.rosenkraenzer.ext@huawei.com>
---
 .../recipes-extended/shadow/shadow_%.bbappend       | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 meta-ohos-core/recipes-extended/shadow/shadow_%.bbappend

diff --git a/meta-ohos-core/recipes-extended/shadow/shadow_%.bbappend b/meta-ohos-core/recipes-extended/shadow/shadow_%.bbappend
new file mode 100644
index 00000000..8f88b53a
--- /dev/null
+++ b/meta-ohos-core/recipes-extended/shadow/shadow_%.bbappend
@@ -0,0 +1,13 @@
+# SPDX-FileCopyrightText: Huawei Inc.
+# SPDX-License-Identifier: Apache-2.0
+
+# shadow uses non-literal format strings to integrate system information
+# into the login prompt. This is harmless because harmful format strings
+# are checked for (and in the worst case, the strings come from a file
+# that is writable by root only).
+#
+# Removing -Werror=format-nonliteral here allows us to use
+# -Werror=format-nonliteral globally in OPTIMIZE_FOR=security mode
+# while keeping shadow building.
+
+TARGET_CFLAGS_remove = "-Werror=format-nonliteral"
-- 
GitLab