From aee58b605cdefa677e8b10f6b9045f3ebcbb3126 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 22 Jan 2026 17:44:25 +0100 Subject: [PATCH] libfdisk: remove duplicate code References: 8b8da020f57414c90981371da71fdf32d2253ac7 Signed-off-by: Karel Zak --- libfdisk/src/dos.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/libfdisk/src/dos.c b/libfdisk/src/dos.c index f85104b28..d1fb77315 100644 --- a/libfdisk/src/dos.c +++ b/libfdisk/src/dos.c @@ -1206,17 +1206,9 @@ static int find_first_free_sector_in_range( there's room for the *next* EBR (stored at start - first_lba). therefore enforce: start(Lnew) >= end(Lprev) + first_lba + 1 */ - if (logical && first > p_end && (first - p_end) <= cxt->first_lba) { - first = p_end + 1 + cxt->first_lba; - first_moved = 1; - - if (first > end) - return -ENOSPC; - - continue; - } + if ((logical && first > p_end && (first - p_end) <= cxt->first_lba) + || first <= p_end) { - if (first <= p_end) { first = p_end + 1 + (logical ? cxt->first_lba : 0); first_moved = 1; -- 2.47.3