From e4a03c6f71fc44073ce36dccc4c825768dc97723 Mon Sep 17 00:00:00 2001 From: Volkan Unal Date: Fri, 26 Jun 2026 19:07:55 +0100 Subject: [PATCH] dasdfmt: Check disk type before prompting for blocksize MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move check_disk() call before user input to fail fast on unsupported or unavailable devices (FBA, read-only, in-use, raw-track mode). Reviewed-by: Jan Höppner Signed-off-by: Volkan Unal Signed-off-by: Jan Höppner --- dasdfmt/dasdfmt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dasdfmt/dasdfmt.c b/dasdfmt/dasdfmt.c index 29606a6b..0fcf2a0f 100644 --- a/dasdfmt/dasdfmt.c +++ b/dasdfmt/dasdfmt.c @@ -1566,6 +1566,8 @@ int main(int argc, char *argv[]) g.ese = dasd_sys_ese(g.dev_node); eval_format_mode(); + check_disk(); + /* Either let the user specify the blksize or get it from the kernel */ if (!g.blksize_specified) { if (!(mode == FULL || @@ -1587,8 +1589,6 @@ int main(int argc, char *argv[]) error("VOLSER not found on device %s", g.dev_path); } - check_disk(); - if (check_param(str, ERR_LENGTH, &format_params) < 0) error("%s", str);