1 Star 0 Fork 44

firstadream/lxc

forked from src-openEuler/lxc 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0029-fix-mixed-use-of-signed-and-unsigned-type.patch 1.32 KB
一键复制 编辑 原始数据 按行查看 历史
From 573aae0ba3b76067e76206b78c8243b34e3f40e3 Mon Sep 17 00:00:00 2001
From: "Neil.wrz" <[email protected]>
Date: Tue, 18 Apr 2023 00:05:27 -0700
Subject: [PATCH] fix mixed use of signed and unsigned type
Signed-off-by: Neil.wrz <[email protected]>
---
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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/firstadream/lxc.git
[email protected]:firstadream/lxc.git
firstadream
lxc
lxc
master

搜索帮助