15 Star 2 Fork 56

src-openEuler/util-linux

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-libblkid-reset-errno-before-calling-probefuncs.patch 2.23 KB
一键复制 编辑 原始数据 按行查看 历史
zhangyao2022 提交于 2024-11-15 16:22 . sync patches from the old version
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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/util-linux.git
git@gitee.com:src-openeuler/util-linux.git
src-openeuler
util-linux
util-linux
master

搜索帮助