1 Star 0 Fork 28

yanshuai/open-iscsi

forked from src-openEuler/open-iscsi 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0020-Fix-more-issues-discovered-by-gcc12.patch 1.66 KB
一键复制 编辑 原始数据 按行查看 历史
Wu Bo 提交于 2022-02-18 13:14 . Backport bugfix patches
From 1cab1efc813f750f9fa68e35dc16e8e54a1ba1e8 Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: Wed, 26 Jan 2022 11:44:09 -0800
Subject: [PATCH] Fix more issues discovered by gcc12
Gcc-12 caught a few more errors in the code, where we are
still checking an array address for NULL, which will never
happen.
---
usr/discovery.c | 2 +-
usr/iscsi_sysfs.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/usr/discovery.c b/usr/discovery.c
index 7dec696..587af6d 100644
--- a/usr/discovery.c
+++ b/usr/discovery.c
@@ -623,7 +623,7 @@ add_target_record(char *name, char *end, discovery_rec_t *drec,
/* if no address is provided, use the default */
if (text >= end) {
- if (drec->address == NULL) {
+ if (drec->address[0] == '\0') {
log_error("no default address known for target %s",
name);
return 0;
diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
index 7bb834a..9a591be 100644
--- a/usr/iscsi_sysfs.c
+++ b/usr/iscsi_sysfs.c
@@ -1416,8 +1416,8 @@ int iscsi_sysfs_get_sessioninfo_by_id(struct session_info *info, char *session)
log_debug(7, "found targetname %s address %s pers address %s port %d "
"pers port %d driver %s iface name %s ipaddress %s "
"netdev %s hwaddress %s iname %s",
- info->targetname, info->address ? info->address : "NA",
- info->persistent_address ? info->persistent_address : "NA",
+ info->targetname, info->address[0] ? info->address : "NA",
+ info->persistent_address[0] ? info->persistent_address : "NA",
info->port, info->persistent_port, info->iface.transport_name,
info->iface.name, info->iface.ipaddress,
info->iface.netdev, info->iface.hwaddress,
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yanyan11222/open-iscsi.git
git@gitee.com:yanyan11222/open-iscsi.git
yanyan11222
open-iscsi
open-iscsi
master

搜索帮助