mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-06 23:26:16 +02:00
* Android: There are cases when libc "environ" var may be NULL. Check for such case and provide fake valid environment. Bug #24519.
git-svn-id: trunk@24804 -
This commit is contained in:
parent
b7d5ed4bd7
commit
7e5af23ace
@ -31,6 +31,9 @@ FPC_SHARED_LIB_START:
|
|||||||
/* Get environment info from libc */
|
/* Get environment info from libc */
|
||||||
ldr ip,=environ
|
ldr ip,=environ
|
||||||
ldr r0,[ip]
|
ldr r0,[ip]
|
||||||
|
/* Check if environment is NULL */
|
||||||
|
cmp r0,#0
|
||||||
|
ldreq r0,=EmptyEnv
|
||||||
ldr ip,=operatingsystem_parameter_envp
|
ldr ip,=operatingsystem_parameter_envp
|
||||||
str r0,[ip]
|
str r0,[ip]
|
||||||
|
|
||||||
@ -69,6 +72,10 @@ EmptyCmdLine:
|
|||||||
.long EmptyCmdStr
|
.long EmptyCmdStr
|
||||||
EmptyCmdStr:
|
EmptyCmdStr:
|
||||||
.ascii "\0"
|
.ascii "\0"
|
||||||
|
EmptyEnv:
|
||||||
|
.long 0
|
||||||
|
.long 0
|
||||||
|
.long 0
|
||||||
|
|
||||||
/* --------------------------------------------------------- */
|
/* --------------------------------------------------------- */
|
||||||
.section .init_array, "aw"
|
.section .init_array, "aw"
|
||||||
|
@ -30,6 +30,11 @@ FPC_SHARED_LIB_START:
|
|||||||
|
|
||||||
/* Get environment info from libc */
|
/* Get environment info from libc */
|
||||||
movl environ,%eax
|
movl environ,%eax
|
||||||
|
/* Check if environment is NULL */
|
||||||
|
cmpl %eax,0
|
||||||
|
jne env_ok
|
||||||
|
leal EmptyEnv,%eax
|
||||||
|
env_ok:
|
||||||
movl %eax,operatingsystem_parameter_envp
|
movl %eax,operatingsystem_parameter_envp
|
||||||
|
|
||||||
/* Register exit handler. It is called only when the main process terminates */
|
/* Register exit handler. It is called only when the main process terminates */
|
||||||
@ -66,6 +71,10 @@ EmptyCmdLine:
|
|||||||
.long EmptyCmdStr
|
.long EmptyCmdStr
|
||||||
EmptyCmdStr:
|
EmptyCmdStr:
|
||||||
.ascii "\0"
|
.ascii "\0"
|
||||||
|
EmptyEnv:
|
||||||
|
.long 0
|
||||||
|
.long 0
|
||||||
|
.long 0
|
||||||
|
|
||||||
/* --------------------------------------------------------- */
|
/* --------------------------------------------------------- */
|
||||||
.section .init_array, "aw"
|
.section .init_array, "aw"
|
||||||
|
Loading…
Reference in New Issue
Block a user