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 <kzak@redhat.com>
This commit is contained in:
Karel Zak 2023-05-11 10:37:54 +02:00
parent 9afcc8a67d
commit 0484ca01c5
2 changed files with 3 additions and 2 deletions

View file

@ -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;

View file

@ -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