代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/python-pyinstaller 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From a95fbb0f497680cce0a097aa3a143e84943b903f Mon Sep 17 00:00:00 2001
From: Hartmut Goebel <h.goebel@crazy-compilers.com>
Date: Sun, 3 May 2020 15:26:43 +0200
Subject: [PATCH] Bootloader: Reimplement pyi_search_path using strtok().
This avoids some places where we need to cope with strncpy(= and related. Also
the implementation becomes much simpler.
---
bootloader/src/pyi_path.c | 34 +++++++---------------------------
1 file changed, 7 insertions(+), 27 deletions(-)
diff --git a/bootloader/src/pyi_path.c b/bootloader/src/pyi_path.c
index 8736de8cc5..fb417e9269 100644
--- a/bootloader/src/pyi_path.c
+++ b/bootloader/src/pyi_path.c
@@ -205,40 +205,20 @@ pyi_path_exists(char * path)
int
pyi_search_path(char * result, const char * appname)
{
- char * path = pyi_getenv("PATH");
- char dirname[PATH_MAX + 1];
- char filename[PATH_MAX + 1];
+ char *path = pyi_getenv("PATH"); // returns a copy
+ char *dirname;
if (NULL == path) {
return -1;
}
- while (1) {
- char *delim = strchr(path, PYI_PATHSEP);
-
- if (delim) {
- size_t len = delim - path;
-
- if (len > PATH_MAX) {
- len = PATH_MAX;
- }
- strncpy(dirname, path, len);
- *(dirname + len) = '\0';
- }
- else { /* last $PATH element */
- strncpy(dirname, path, PATH_MAX);
- }
- pyi_path_join(filename, dirname, appname);
-
- if (pyi_path_exists(filename)) {
- strncpy(result, filename, PATH_MAX);
+ dirname = strtok(path, PYI_PATHSEPSTR);
+ while (dirname != NULL) {
+ pyi_path_join(result, dirname, appname);
+ if (pyi_path_exists(result)) {
return 0;
}
-
- if (!delim) {
- break;
- }
- path = delim + 1;
+ dirname = strtok(NULL, PYI_PATHSEPSTR);
}
return -1;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。