代码拉取完成,页面将自动刷新
From 4bc69757312cad09f0cd9dc0c04f483a76176203 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas@t-8ch.de>
Date: Mon, 2 Oct 2023 22:24:21 +0200
Subject: [PATCH] libblkid: reset errno before calling probefuncs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
Reference:https://github.com/util-linux/util-linux/commit/4bc69757312cad09f0cd9dc0c04f483a76176203
Conflict:NA
---
libblkid/src/partitions/partitions.c | 1 +
libblkid/src/superblocks/superblocks.c | 1 +
libblkid/src/topology/topology.c | 1 +
3 files changed, 3 insertions(+)
diff --git a/libblkid/src/partitions/partitions.c b/libblkid/src/partitions/partitions.c
index 0e38cf4..38ec8df 100644
--- a/libblkid/src/partitions/partitions.c
+++ b/libblkid/src/partitions/partitions.c
@@ -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 */
diff --git a/libblkid/src/superblocks/superblocks.c b/libblkid/src/superblocks/superblocks.c
index f213655..09ac45e 100644
--- a/libblkid/src/superblocks/superblocks.c
+++ b/libblkid/src/superblocks/superblocks.c
@@ -410,6 +410,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);
diff --git a/libblkid/src/topology/topology.c b/libblkid/src/topology/topology.c
index 53007d1..e8b9ba8 100644
--- a/libblkid/src/topology/topology.c
+++ b/libblkid/src/topology/topology.c
@@ -180,6 +180,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;
if (id->probefunc(pr, NULL) != 0)
continue;
}
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。