!68 fix exec crash

Merge pull request !68 from 张吉东/fix_exec_release_503
This commit is contained in:
openharmony_ci
2025-03-04 11:23:42 +00:00
committed by Gitee
2 changed files with 9 additions and 0 deletions
+3
View File
@@ -244,6 +244,9 @@ if (defined(ohos_lite)) {
"-DMKSH_UNLIMITED",
"-DMKSH_BUILD_R=593",
]
defines = [ "MKSH_OH_ADAPT" ]
ldflags = [
"-pie",
"-Wl,-z,relro",
+6
View File
@@ -1167,6 +1167,12 @@ builtin(const char *name, int (*func) (const char **))
struct tbl *
findcom(const char *name, int flags)
{
#ifdef MKSH_OH_ADAPT
// fix crash for 'exec -a0'
if (name == NULL) {
return NULL;
}
#endif
static struct tbl temp;
uint32_t h = hash(name);
struct tbl *tp = NULL, *tbi;