mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
dasdfmt: Improve error message construction
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>
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user