!395 [sync] PR-393: add sscanf adapation code for musl
From: @openeuler-sync-bot Reviewed-by: @duguhaotian Signed-off-by: @duguhaotian
This commit is contained in:
commit
66c0b11e19
31
0055-add-sscanf-adapation-code-for-musl.patch
Normal file
31
0055-add-sscanf-adapation-code-for-musl.patch
Normal file
@ -0,0 +1,31 @@
|
||||
From 04399ce74d89f7260474e915a978d31d62367889 Mon Sep 17 00:00:00 2001
|
||||
From: zhongtao <zhongtao17@huawei.com>
|
||||
Date: Wed, 4 Jan 2023 13:17:34 +0800
|
||||
Subject: [PATCH] add sscanf adapation code for musl
|
||||
|
||||
Signed-off-by: zhongtao <zhongtao17@huawei.com>
|
||||
---
|
||||
src/lxc/utils.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/src/lxc/utils.c b/src/lxc/utils.c
|
||||
index ed66935..3838f69 100644
|
||||
--- a/src/lxc/utils.c
|
||||
+++ b/src/lxc/utils.c
|
||||
@@ -2134,7 +2134,13 @@ static proc_t *lxc_stat2proc(const char *S)
|
||||
(void)memset(P, 0x00, sizeof(proc_t));
|
||||
|
||||
/* parse these two strings separately, skipping the leading "(". */
|
||||
+ /* https://www.openwall.com/lists/musl/2013/11/15/5: musl's sscanf("%15c",cmd)
|
||||
+ requires exactly 15 characters; anything shorter is a matching failure. */
|
||||
+#ifdef __MUSL__
|
||||
+ num = sscanf(S, "%d (%15s", &P->pid, P->cmd); /* comm[16] in kernel */
|
||||
+#else
|
||||
num = sscanf(S, "%d (%15c", &P->pid, P->cmd); /* comm[16] in kernel */
|
||||
+#endif
|
||||
if (num != 2) {
|
||||
ERROR("Call sscanf error: %s", errno ? strerror(errno) : "");
|
||||
free(P);
|
||||
--
|
||||
2.25.1
|
||||
|
||||
9
lxc.spec
9
lxc.spec
@ -1,4 +1,4 @@
|
||||
%global _release 2022102406
|
||||
%global _release 2022102407
|
||||
|
||||
Name: lxc
|
||||
Version: 4.0.3
|
||||
@ -62,6 +62,7 @@ Patch0051: 0051-add-macro-to-adapt-musl-libc.patch
|
||||
Patch0052: 0052-add-lxc-attach-add-gids-option.patch
|
||||
Patch0053: 0053-change-the-suffi-parameter-in-lxc-attach-help-output.patch
|
||||
Patch0054: 0054-rollback-strprint-code-modified.patch
|
||||
Patch0055: 0055-add-sscanf-adapation-code-for-musl.patch
|
||||
|
||||
BuildRequires: systemd-units git libtool graphviz docbook2X doxygen chrpath
|
||||
BuildRequires: pkgconfig(libseccomp)
|
||||
@ -242,6 +243,12 @@ make check
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Wed Jan 04 2023 zhongtao<zhongtao17@huawei.com> - 4.0.3-2022102407
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC: add sscanf adapation code for musl
|
||||
|
||||
* Mon Dec 26 2022 zhangxiaoyu<zhangxiaoyu58@huawei.com> - 4.0.3-2022102406
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
|
||||
@ -50,4 +50,6 @@
|
||||
0050-lxc-Add-sw64-architecture.patch
|
||||
0051-add-macro-to-adapt-musl-libc.patch
|
||||
0052-add-lxc-attach-add-gids-option.patch
|
||||
0053-change-the-suffi-parameter-in-lxc-attach-help-output.patch
|
||||
0053-change-the-suffi-parameter-in-lxc-attach-help-output.patch
|
||||
0054-rollback-strprint-code-modified.patch
|
||||
0055-add-sscanf-adapation-code-for-musl.patch
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user