]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: reset errno before calling probefuncs
authorThomas Weißschuh <thomas@t-8ch.de>
Mon, 2 Oct 2023 20:24:21 +0000 (22:24 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 24 Nov 2023 10:01:29 +0000 (11:01 +0100)
The probers optionally use errno to communicate error details.
When a leftover errno is set from libblkid internally this can confuse
the probers.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/partitions/partitions.c
libblkid/src/superblocks/superblocks.c
libblkid/src/topology/topology.c

index 1c344fd30334d60cfe6c75aa442247a1324f86ea..8ebf480f55c07c7676e7bd09a270b46e43857eea 100644 (file)
@@ -555,6 +555,7 @@ static int idinfo_probe(blkid_probe pr, const struct blkid_idinfo *id,
        if (id->probefunc) {
                DBG(LOWPROBE, ul_debug(
                        "%s: ---> call probefunc()", id->name));
+               errno = 0;
                rc = id->probefunc(pr, mag);
                if (rc < 0) {
                        /* reset after error */
index fb0392707896bdcc48df33b8ac63b878812533bc..96bc0ef89627788ce5acae2ea9d302bee6ebddce 100644 (file)
@@ -421,6 +421,7 @@ static int superblocks_probe(blkid_probe pr, struct blkid_chain *chn)
                /* final check by probing function */
                if (id->probefunc) {
                        DBG(LOWPROBE, ul_debug("\tcall probefunc()"));
+                       errno = 0;
                        rc = id->probefunc(pr, mag);
                        if (rc != BLKID_PROBE_OK) {
                                blkid_probe_chain_reset_values(pr, chn);
index cd1f4c25f747736b64256552c35370aad2566889..67df3e3389c941c281397b8793e0b318d0559ed7 100644 (file)
@@ -182,6 +182,8 @@ static int topology_probe(blkid_probe pr, struct blkid_chain *chn)
 
                if (id->probefunc) {
                        DBG(LOWPROBE, ul_debug("%s: call probefunc()", id->name));
+
+                       errno = 0;
                        if (id->probefunc(pr, NULL) != 0)
                                continue;
                }