代码拉取完成,页面将自动刷新
同步操作将从 src-anolis-os/systemd 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 5209a26aa917aa54b09ee18394ad46ee601e77be Mon Sep 17 00:00:00 2001
From: Yuanhong Peng <yummypeng@linux.alibaba.com>
Date: Tue, 17 May 2022 21:34:34 +0800
Subject: [PATCH] test-catalog: Fix coredump when compiled under GCC10
According to the documentation:
https://gcc.gnu.org/gcc-9/porting_to.html#complit:
The `catalog_dirs` produced by STRV_MAKE(..) marco relies on
the extended lifetime feature which is fixed by GCC9.
Signed-off-by: Yuanhong Peng <yummypeng@linux.alibaba.com>
---
src/journal/test-catalog.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/journal/test-catalog.c b/src/journal/test-catalog.c
index 0c4da29..2ce92af 100644
--- a/src/journal/test-catalog.c
+++ b/src/journal/test-catalog.c
@@ -201,7 +201,8 @@ static void test_catalog_file_lang(void) {
int main(int argc, char *argv[]) {
_cleanup_(unlink_tempfilep) char database[] = "/tmp/test-catalog.XXXXXX";
- _cleanup_free_ char *text = NULL, *catalog_dir = NULL;
+ _cleanup_free_ char *text = NULL;
+ char *catalog_dir = CATALOG_DIR;
int r;
setlocale(LC_ALL, "de_DE.UTF-8");
@@ -214,10 +215,9 @@ int main(int argc, char *argv[]) {
* If it is not, e.g. installed by systemd-tests package, then use installed catalogs. */
if (test_is_running_from_builddir(NULL)) {
assert_se(catalog_dir = path_join(NULL, ABS_BUILD_DIR, "catalog"));
- catalog_dirs = STRV_MAKE(catalog_dir);
- } else
- catalog_dirs = STRV_MAKE(CATALOG_DIR);
+ }
+ catalog_dirs = STRV_MAKE(catalog_dir);
assert_se(access(catalog_dirs[0], F_OK) >= 0);
log_notice("Using catalog directory '%s'", catalog_dirs[0]);
@@ -242,5 +242,9 @@ int main(int argc, char *argv[]) {
assert_se(catalog_get(database, SD_MESSAGE_COREDUMP, &text) >= 0);
printf(">>>%s<<<\n", text);
+ /* Only in this case, catalog_dir is malloced */
+ if (test_is_running_from_builddir(NULL))
+ free(catalog_dir);
+
return 0;
}
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。