38 lines
1.6 KiB
Diff
38 lines
1.6 KiB
Diff
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
|
|
|