Fix glib hash_table is not NULL assert

This commit is contained in:
bizhiyuan 2023-10-17 18:14:14 +08:00
parent c67225f111
commit 892c1e7091
2 changed files with 41 additions and 1 deletions

View File

@ -0,0 +1,35 @@
From c642d0efb5606101b8ea0d30b95cb1b47af05e1d Mon Sep 17 00:00:00 2001
From: bizhiyuan <bizhiyuan@kylinos.cn>
Date: Tue, 17 Oct 2023 17:31:21 +0800
Subject: [PATCH] Fix glib hash_table is not NULL assert
---
src/attr.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/attr.c b/src/attr.c
index 09c15bc..5f057ae 100644
--- a/src/attr.c
+++ b/src/attr.c
@@ -357,6 +357,8 @@ static cmd_result_t attr_get(struct ticket_config *tk, int fd, struct boothc_att
* lookup attr
* send value
*/
+ if (!tk->attr)
+ return RLT_NO_SUCH_ATTR;
a = (struct geo_attr *)g_hash_table_lookup(tk->attr, msg->attr.name);
if (!a)
@@ -392,6 +394,9 @@ static cmd_result_t attr_list(struct ticket_config *tk, int fd, struct boothc_at
return RLT_SYNC_FAIL;
}
g_hash_table_foreach(tk->attr, append_attr, data);
+ if (tk->attr) {
+ g_hash_table_foreach(tk->attr, append_attr, data);
+ }
init_header(&hdr.header, ATTR_LIST, 0, 0, RLT_SUCCESS, 0,
sizeof(hdr) + data->len);
--
2.27.0

View File

@ -10,7 +10,7 @@
%global git_describe_str v1.0-283-g9d4029aa14323a7f3b496215d25e40bd14f33632
# Set this to 1 when rebasing (changing git_describe_str) and increase otherwise
%global release 8
%global release 9
# Run shell script to parse git_describe str into version, numcomm and sha1 hash
%global booth_ver %(s=%{git_describe_str}; vver=${s%%%%-*}; echo ${vver:1})
@ -38,6 +38,8 @@ License: GPLv2+
Url: https://github.com/%{github_owner}/%{name}
Source0: https://github.com/%{github_owner}/%{name}/archive/%{booth_short_sha1}/%{booth_archive_name}.tar.gz
Patch0: Fix-glib-hash_table-is-not-NULL-assert.patch
# direct build process dependencies
BuildRequires: autoconf
BuildRequires: automake
@ -264,6 +266,9 @@ VERBOSE=1 make check
%{_usr}/lib/ocf/resource.d/booth/sharedrsc
%changelog
* Tue Oct 17 2023 bizhiyuan <bizhiyuan@kylinos.cn> - 1.0-9
- Fix glib hash table is not NULL assert
* Fri Mar 17 2023 jiangxinyu <jiangxinyu@kylinos.cn> - 1.0-8
- Modify folder permissions