From: Karel Zak Date: Mon, 9 Aug 2010 09:32:46 +0000 (+0200) Subject: cfdisk: fix n+1 bug in error message X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3d9440ee18f27ed3412d3337c042834138c5b523;p=util-linux 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 --- 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); } }