]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: remove duplicate code
authorKarel Zak <kzak@redhat.com>
Thu, 22 Jan 2026 16:44:25 +0000 (17:44 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 22 Jan 2026 16:44:25 +0000 (17:44 +0100)
References: 8b8da020f57414c90981371da71fdf32d2253ac7
Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk/src/dos.c

index f85104b2828f0baebd3d0ed033ba2e3cb531b45c..d1fb77315618e5e468c6b158fa72995473f5ef6d 100644 (file)
@@ -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;