1 Star 0 Fork 17

yanxiaodan / libblockdev

forked from src-openEuler / libblockdev 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0002-module.c-Fix-error-message-when-loading-module-witho.patch 1.62 KB
AI 代码解读
一键复制 编辑 原始数据 按行查看 历史
From be58ebe20fd9fdfc2db7bdd99a55eff835cef23a Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Wed, 10 Jun 2020 14:31:15 +0200
Subject: [PATCH 184/193] module.c: Fix error message when loading module
without options
Lets avoid error messages like "Failed to load the module 'kvdo'
with options '(null)'".
---
src/utils/module.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/utils/module.c b/src/utils/module.c
index 988f603..eb3f765 100644
--- a/src/utils/module.c
+++ b/src/utils/module.c
@@ -167,9 +167,14 @@ gboolean bd_utils_load_kernel_module (const gchar *module_name, const gchar *opt
ret = kmod_module_probe_insert_module (mod, KMOD_PROBE_FAIL_ON_LOADED,
options, NULL, NULL, NULL);
if (ret < 0) {
- g_set_error (error, BD_UTILS_MODULE_ERROR, BD_UTILS_MODULE_ERROR_FAIL,
- "Failed to load the module '%s' with options '%s': %s",
- module_name, options, strerror_l (-ret, c_locale));
+ if (options)
+ g_set_error (error, BD_UTILS_MODULE_ERROR, BD_UTILS_MODULE_ERROR_FAIL,
+ "Failed to load the module '%s' with options '%s': %s",
+ module_name, options, strerror_l (-ret, c_locale));
+ else
+ g_set_error (error, BD_UTILS_MODULE_ERROR, BD_UTILS_MODULE_ERROR_FAIL,
+ "Failed to load the module '%s': %s",
+ module_name, strerror_l (-ret, c_locale));
kmod_module_unref (mod);
kmod_unref (ctx);
freelocale (c_locale);
--
1.8.3.1
1
https://gitee.com/yanxiaodan/libblockdev.git
git@gitee.com:yanxiaodan/libblockdev.git
yanxiaodan
libblockdev
libblockdev
master

搜索帮助