Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.5:Update
s390-tools.19608
s390-tools-sles15sp2-dasdfmt-Improve-error-mess...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File s390-tools-sles15sp2-dasdfmt-Improve-error-message-construction.patch of Package s390-tools.19608
From 9fe491df276a28ac68a6d9fab9bd8bae861708f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20H=C3=B6ppner?= <hoeppner@linux.ibm.com> Date: Mon, 26 Oct 2020 02:39:27 +0100 Subject: [PATCH] dasdfmt: Improve error message construction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In check_track_format() the base error message is the same for all cases but has different additional content depending on which mode dasdfmt is running. Currently the message is compiled by using different outputs. To make it a little bit cleaner and for a better error message handling, construct the message string completely before passing it to the error() function for output. Reviewed-by: Stefan Haberland <sth@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com> --- dasdfmt/dasdfmt.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/dasdfmt/dasdfmt.c b/dasdfmt/dasdfmt.c index 86e9330..94f5d91 100644 --- a/dasdfmt/dasdfmt.c +++ b/dasdfmt/dasdfmt.c @@ -791,19 +791,18 @@ static format_check_t check_track_format(format_data_t *p) .stop_unit = p->stop_unit }, 0 }; + char msg[128] = ""; int err; err = dasd_check_format(g.dev_node, &cdata); if (err != 0) { if (err == ENOTTY) { - ERRMSG("%s: Missing kernel support for format checking", - prog_name); - if (mode == EXPAND) { - ERRMSG(". Mode 'expand' cannot be used"); - } else if (!g.check) { - ERRMSG(" (--force to override)"); - } - error("."); + sprintf(msg, "Missing kernel support for format checking"); + if (mode == EXPAND) + strcat(msg, ". Mode 'expand' cannot be used"); + else if (!g.check) + strcat(msg, " (--force to override)"); + error("%s.", msg); } error("Could not check format: %s", strerror(err)); } -- 2.26.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor