]> 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)
committerThomas Weißschuh <thomas@t-8ch.de>
Mon, 2 Oct 2023 21:34:00 +0000 (23:34 +0200)
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>
libblkid/src/partitions/partitions.c
libblkid/src/superblocks/superblocks.c
libblkid/src/topology/topology.c

index 6a11c5069802d26128683c7a29e87c89b970b133..e096cf8f72aff3c611473b14603e4ea3e872399b 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);
                blkid_probe_prune_buffers(pr);
                if (rc < 0) {
index e89af1b629c9ef5a84f35e4baffd4ed4cf976a0b..f64b19aef1dbc65858befd3e5ad79dd1ecdee2c7 100644 (file)
@@ -417,6 +417,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);
                        blkid_probe_prune_buffers(pr);
                        if (rc != BLKID_PROBE_OK) {
index 1fe7c639430752b68fbca8de14f5a6bb90de589c..f19a4f2be5f4dfceb7f1a6b739e5b197d1d25f1e 100644 (file)
@@ -183,6 +183,7 @@ 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;
                        rc = id->probefunc(pr, NULL);
                        blkid_probe_prune_buffers(pr);
                        if (rc != 0)