!452 fix mixed use of signed and unsigned type

From: @driedyellowpeach 
Reviewed-by: @duguhaotian 
Signed-off-by: @duguhaotian
This commit is contained in:
openeuler-ci-bot 2023-04-18 11:56:59 +00:00 committed by Gitee
commit 24267c8fa0
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 59 additions and 1 deletions

View File

@ -0,0 +1,51 @@
From 573aae0ba3b76067e76206b78c8243b34e3f40e3 Mon Sep 17 00:00:00 2001
From: "Neil.wrz" <wangrunze13@huawei.com>
Date: Tue, 18 Apr 2023 00:05:27 -0700
Subject: [PATCH] fix mixed use of signed and unsigned type
Signed-off-by: Neil.wrz <wangrunze13@huawei.com>
---
src/lxc/path.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/lxc/path.c b/src/lxc/path.c
index 46256cb..c0529b7 100644
--- a/src/lxc/path.c
+++ b/src/lxc/path.c
@@ -101,7 +101,7 @@ bool filepath_split(const char *path, char **dir, char **base)
ERROR("Invalid path");
return false;
}
- i = len - 1;
+ i = (ssize_t)(len - 1);
while (i >= 0 && path[i] != '/')
i--;
@@ -326,7 +326,7 @@ static int do_get_symlinks(const char **fullpath, const char *prefix, size_t pre
}
len = strlen(*end);
- if (len >= PATH_MAX - n) {
+ if (len >= (size_t)(PATH_MAX - n)) {
ERROR("Path is too long");
goto out;
}
@@ -619,7 +619,7 @@ char *path_relative(const char *basepath, const char *targpath)
if (b0 != bl) {
// Base elements left. Must go up before going down.
- int seps = 0, i;
+ size_t seps = 0, i;
size_t ncopyed = 0, seps_size;
char *buf = NULL;
@@ -652,4 +652,4 @@ char *path_relative(const char *basepath, const char *targpath)
}
return safe_strdup(targ + t0);
-}
\ No newline at end of file
+}
--
2.25.1

View File

@ -1,4 +1,4 @@
%global _release 2022102415
%global _release 2022102416
Name: lxc
Version: 4.0.3
@ -36,6 +36,7 @@ Patch0025: 0025-fix-ops-hierarchies-cause-coredump.patch
Patch0026: 0026-meminfo-cri-1.25.patch
Patch0027: 0027-add-loongarch64-support-for-lxc.patch
Patch0028: 0028-use-ocihooks-env-after-getenv.patch
Patch0029: 0029-fix-mixed-use-of-signed-and-unsigned-type.patch
BuildRequires: systemd-units git libtool graphviz docbook2X doxygen chrpath
BuildRequires: pkgconfig(libseccomp)
@ -222,6 +223,12 @@ rm -rf %{buildroot}%{_sysconfdir}/default/%{name}
%endif
%changelog
* Mon Apr 17 2023 wangrunze<wangrunze13@huawei.com> - 4.0.3-2022102416
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: fix mixed use of signed and unsigned type
* Thu Mar 30 2023 zhangxiaoyu<zhangxiaoyu58@huawei.com> - 4.0.3-2022102415
- Type:bugfix
- ID:NA