From 3d9440ee18f27ed3412d3337c042834138c5b523 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 9 Aug 2010 11:32:46 +0200 Subject: [PATCH] cfdisk: fix n+1 bug in error message # cfdisk -Ps correctly uses 1..N range for partition numbers, unfortunately some error messages use 0..N. This is confusing. Reported-by: J B Signed-off-by: Karel Zak --- fdisk/cfdisk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fdisk/cfdisk.c b/fdisk/cfdisk.c index e7955fe5..610b8471 100644 --- a/fdisk/cfdisk.c +++ b/fdisk/cfdisk.c @@ -1629,7 +1629,7 @@ fill_p_info(void) { ((bs <= sectors) ? bs : 0), 1, &errmsg)) { char *bad = _("Bad primary partition"); char *msg = (char *) xmalloc(strlen(bad) + strlen(errmsg) + 30); - sprintf(msg, "%s %d: %s", bad, i, errmsg); + sprintf(msg, "%s %d: %s", bad, i + 1, errmsg); fatal(msg, 4); } if (is_extended(buffer.p.part[i].sys_ind)) @@ -1659,7 +1659,7 @@ fill_p_info(void) { bs, 1, &errmsg)) { char *bad = _("Bad logical partition"); char *msg = (char *) xmalloc(strlen(bad) + strlen(errmsg) + 30); - sprintf(msg, "%s %d: %s", bad, i, errmsg); + sprintf(msg, "%s %d: %s", bad, i + 1, errmsg); fatal(msg, 4); } } -- 2.39.5