iscsi-initiator-utils/SOURCES/0024-libopeniscsiusr-fix-error-messages.patch

97 lines
3.7 KiB
Diff

From 13affd82b8248b954d10eb4fd3d544796360fafd Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Wed, 17 Feb 2021 09:56:55 -0800
Subject: [PATCH] libopeniscsiusr: fix error messages
The error message in iscsi_session_get [libopeniscsiusr/session.c:140]
when a session or connection path isn't found in sysfs was failing to
print the session ID, instead it printed the address of the static
string for the remainder of the message ("does not exists") due to an
extra comma.
Additionally change all occurances of "does not exists" to "does not
exist"
Signed-off-by: Chris Leech <cleech@redhat.com>
---
libopeniscsiusr/libopeniscsiusr/libopeniscsiusr.h | 2 +-
libopeniscsiusr/session.c | 6 +++---
libopeniscsiusr/sysfs.c | 8 ++++----
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/libopeniscsiusr/libopeniscsiusr/libopeniscsiusr.h b/libopeniscsiusr/libopeniscsiusr/libopeniscsiusr.h
index 4395902..a29d5b1 100644
--- a/libopeniscsiusr/libopeniscsiusr/libopeniscsiusr.h
+++ b/libopeniscsiusr/libopeniscsiusr/libopeniscsiusr.h
@@ -288,7 +288,7 @@ __DLL_EXPORT void iscsi_sessions_free(struct iscsi_session **ses,
* Output pointer of 'struct iscsi_session' pointer. Its memory
* should be freed by iscsi_session_free().
* If this pointer is NULL, your program will be terminated by assert.
- * If specified iSCSI session does not exists, this pointer will be set to
+ * If specified iSCSI session does not exist, this pointer will be set to
* NULL with LIBISCSI_OK returned.
*
* Return:
diff --git a/libopeniscsiusr/session.c b/libopeniscsiusr/session.c
index 7ace4d6..f122fe3 100644
--- a/libopeniscsiusr/session.c
+++ b/libopeniscsiusr/session.c
@@ -127,17 +127,17 @@ int iscsi_session_get(struct iscsi_context *ctx, uint32_t sid,
_alloc_null_check(ctx, *se , rc, out);
if (! _file_exists(sysfs_se_dir_path)) {
- _info(ctx, "Sysfs path '%s' does not exists",
+ _info(ctx, "Sysfs path '%s' does not exist",
sysfs_se_dir_path);
rc = LIBISCSI_ERR_SESS_NOT_FOUND;
}
if (! _file_exists(sysfs_con_dir_path)) {
- _info(ctx, "Sysfs path '%s' does not exists",
+ _info(ctx, "Sysfs path '%s' does not exist",
sysfs_se_dir_path);
rc = LIBISCSI_ERR_SESS_NOT_FOUND;
}
if (rc == LIBISCSI_ERR_SESS_NOT_FOUND) {
- _error(ctx, "Specified SID %" PRIu32, "does not exists",
+ _error(ctx, "Specified SID %" PRIu32 " does not exist",
sid);
goto out;
}
diff --git a/libopeniscsiusr/sysfs.c b/libopeniscsiusr/sysfs.c
index 2c3f077..355ad55 100644
--- a/libopeniscsiusr/sysfs.c
+++ b/libopeniscsiusr/sysfs.c
@@ -169,11 +169,11 @@ int _sysfs_prop_get_str(struct iscsi_context *ctx, const char *dir_path,
if (default_value == NULL) {
rc = LIBISCSI_ERR_SYSFS_LOOKUP;
_error(ctx, "Failed to read '%s': "
- "file '%s' does not exists", prop_name,
+ "file '%s' does not exist", prop_name,
file_path);
} else {
_info(ctx, "Failed to read '%s': "
- "file '%s' does not exists, "
+ "file '%s' does not exist, "
"using default value %s", prop_name,
file_path, default_value);
memcpy(buff, (void *) default_value,
@@ -244,13 +244,13 @@ static int iscsi_sysfs_prop_get_ll(struct iscsi_context *ctx,
if (! ignore_error) {
rc = LIBISCSI_ERR_SYSFS_LOOKUP;
_error(ctx, "Failed to read '%s': "
- "file '%s' does not exists",
+ "file '%s' does not exist",
prop_name, file_path);
goto out;
} else {
_info(ctx,
"Failed to read '%s': "
- "File '%s' does not exists, using ",
+ "File '%s' does not exist, using ",
"default value %lld",
prop_name, file_path, default_value);
*val = default_value;
--
2.26.2