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>
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 */
/* 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);
if (id->probefunc) {
DBG(LOWPROBE, ul_debug("%s: call probefunc()", id->name));
+
+ errno = 0;
if (id->probefunc(pr, NULL) != 0)
continue;
}