fix print and len

Signed-off-by: chegJH <hejunjie10@huawei.com>
This commit is contained in:
chegJH 2022-03-01 16:30:04 +08:00
parent e7c60ddaca
commit a4b7c57280
3 changed files with 48 additions and 1 deletions

View File

@ -0,0 +1,39 @@
From 178d09524a346cab9ca1f9eb939e35945b7bfbb0 Mon Sep 17 00:00:00 2001
From: chegJH <hejunjie10@huawei.com>
Date: Mon, 21 Feb 2022 19:14:56 +0800
Subject: [PATCH] fix always print and temp len
Signed-off-by: chegJH <hejunjie10@huawei.com>
---
src/lxc/confile_utils.h | 2 +-
src/lxc/lxclock.c | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/lxc/confile_utils.h b/src/lxc/confile_utils.h
index 62990e9..3655ec4 100644
--- a/src/lxc/confile_utils.h
+++ b/src/lxc/confile_utils.h
@@ -13,7 +13,7 @@
if (str) \
len = snprintf(str, inlen, ##__VA_ARGS__); \
else \
- len = snprintf((char *){""}, 0, ##__VA_ARGS__); \
+ len = 0; \
if (len < 0) { \
SYSERROR("failed to create string"); \
return -1; \
diff --git a/src/lxc/lxclock.c b/src/lxc/lxclock.c
index d65c614..9c9b57c 100644
--- a/src/lxc/lxclock.c
+++ b/src/lxc/lxclock.c
@@ -177,6 +177,7 @@ struct lxc_lock *lxc_newlock(const char *lxcpath, const char *name)
}
l->u.f.fd = -1;
+ return l;
on_error:
fprintf(stderr, "Failed to create lock for %s, path %s\n", name, lxcpath);
--
2.32.0 (Apple Git-132)

View File

@ -1,4 +1,4 @@
%global _release 2022021501 %global _release 2022022101
Name: lxc Name: lxc
Version: 4.0.3 Version: 4.0.3
@ -44,6 +44,7 @@ Patch0033: 0033-conf-ensure-that-the-idmap-pointer-itself-is-freed.patch
Patch0034: 0034-cgfsng-fix-cgroup-attach-cgroup-creation.patch Patch0034: 0034-cgfsng-fix-cgroup-attach-cgroup-creation.patch
Patch0035: 0035-adapt-upstream-compiler-settings.patch Patch0035: 0035-adapt-upstream-compiler-settings.patch
Patch0036: 0036-compile-in-android-env.patch Patch0036: 0036-compile-in-android-env.patch
Patch0037: 0037-fix-always-print-and-temp-len.patch
BuildRequires: systemd-units git libtool graphviz docbook2X doxygen chrpath BuildRequires: systemd-units git libtool graphviz docbook2X doxygen chrpath
BuildRequires: pkgconfig(libseccomp) BuildRequires: pkgconfig(libseccomp)
@ -215,6 +216,12 @@ make check
%{_mandir}/*/man7/%{name}* %{_mandir}/*/man7/%{name}*
%changelog %changelog
* Mon Feb 21 2022 chegJH <hejunjie10@huawei.com> - 4.0.3-2022022101
- Type:improv
- ID:NA
- SUG:NA
- DESC: fix alwasy print and len
* Tue Feb 15 2022 chegJH <hejunjie10@huawei.com> - 4.0.3-2022021501 * Tue Feb 15 2022 chegJH <hejunjie10@huawei.com> - 4.0.3-2022021501
- Type:improve - Type:improve
- ID:NA - ID:NA

View File

@ -34,3 +34,4 @@
0034-cgfsng-fix-cgroup-attach-cgroup-creation.patch 0034-cgfsng-fix-cgroup-attach-cgroup-creation.patch
0035-adapt-upstream-compiler-settings.patch 0035-adapt-upstream-compiler-settings.patch
0036-compile-in-android-env.patch 0036-compile-in-android-env.patch
0037-fix-always-print-and-temp-len.patch