File s390-tools-sles15sp2-dasdfmt-Make-error-function-less-error-prone.patch of Package s390-tools.19608

From cad450fdf9a9dd2562eec27157e4fd133a98813e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20H=C3=B6ppner?= <hoeppner@linux.ibm.com>
Date: Mon, 2 Nov 2020 10:53:24 +0100
Subject: [PATCH] dasdfmt: Make error function less error-prone
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Add a proper definition to the dasdfmt header file of the error()
function that lets the compiler check the format string against the
provided parameters.

Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
---
 dasdfmt/dasdfmt.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/dasdfmt/dasdfmt.h b/dasdfmt/dasdfmt.h
index 9d35eed..4d6fbb5 100644
--- a/dasdfmt/dasdfmt.h
+++ b/dasdfmt/dasdfmt.h
@@ -41,6 +41,10 @@ static const char mode_str[3][10] = {
 	"Full", "Quick", "Expand"
 };
 
+/* Report error, free memory, and exit */
+static void error(const char *format, ...)
+	__attribute__((__noreturn__, __format__(__printf__, 1, 2)));
+
 #define DASD_PARTN_BITS 2
 #define PARTN_MASK ((1 << DASD_PARTN_BITS) - 1)
 
-- 
2.26.2

openSUSE Build Service is sponsored by