From 0484ca01c5ab83d500ba37daf67bc17213e39363 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 11 May 2023 10:37:54 +0200 Subject: [PATCH] libfdisk: fix fdisk_check_collisions return code The return code (>0) is nowhere in the library used, but let's be compatible with function comment ;-) Signed-off-by: Karel Zak --- libfdisk/src/context.c | 1 + libfdisk/src/wipe.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libfdisk/src/context.c b/libfdisk/src/context.c index 083b255d3b..0d221242e5 100644 --- a/libfdisk/src/context.c +++ b/libfdisk/src/context.c @@ -631,6 +631,7 @@ static int fdisk_assign_fd(struct fdisk_context *cxt, int fd, /* Don't report collision if there is already a valid partition table. * The bootbits are wiped when we create a *new* partition table only. */ if (fdisk_is_ptcollision(cxt) && fdisk_has_label(cxt)) { + DBG(CXT, ul_debugobj(cxt, "ignore old %s", cxt->collision)); cxt->pt_collision = 0; free(cxt->collision); cxt->collision = NULL; diff --git a/libfdisk/src/wipe.c b/libfdisk/src/wipe.c index c3d5d754b2..54f4213959 100644 --- a/libfdisk/src/wipe.c +++ b/libfdisk/src/wipe.c @@ -171,7 +171,7 @@ int fdisk_check_collisions(struct fdisk_context *cxt) assert(cxt); assert(cxt->dev_fd >= 0); - DBG(CXT, ul_debugobj(cxt, "wipe check: initialize libblkid prober")); + DBG(WIPE, ul_debugobj(cxt, "wipe check: initialize libblkid prober")); pr = blkid_new_probe(); if (!pr) @@ -208,6 +208,6 @@ int fdisk_check_collisions(struct fdisk_context *cxt) } blkid_free_probe(pr); - return rc; + return rc < 0 ? rc : cxt->collision ? 1 : 0; } #endif -- 2.47.2