mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-08 10:48:12 +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 */
|
||||
ldr ip,=environ
|
||||
ldr r0,[ip]
|
||||
/* Check if environment is NULL */
|
||||
cmp r0,#0
|
||||
ldreq r0,=EmptyEnv
|
||||
ldr ip,=operatingsystem_parameter_envp
|
||||
str r0,[ip]
|
||||
|
||||
@ -69,6 +72,10 @@ EmptyCmdLine:
|
||||
.long EmptyCmdStr
|
||||
EmptyCmdStr:
|
||||
.ascii "\0"
|
||||
EmptyEnv:
|
||||
.long 0
|
||||
.long 0
|
||||
.long 0
|
||||
|
||||
/* --------------------------------------------------------- */
|
||||
.section .init_array, "aw"
|
||||
|
@ -30,6 +30,11 @@ FPC_SHARED_LIB_START:
|
||||
|
||||
/* Get environment info from libc */
|
||||
movl environ,%eax
|
||||
/* Check if environment is NULL */
|
||||
cmpl %eax,0
|
||||
jne env_ok
|
||||
leal EmptyEnv,%eax
|
||||
env_ok:
|
||||
movl %eax,operatingsystem_parameter_envp
|
||||
|
||||
/* Register exit handler. It is called only when the main process terminates */
|
||||
@ -66,6 +71,10 @@ EmptyCmdLine:
|
||||
.long EmptyCmdStr
|
||||
EmptyCmdStr:
|
||||
.ascii "\0"
|
||||
EmptyEnv:
|
||||
.long 0
|
||||
.long 0
|
||||
.long 0
|
||||
|
||||
/* --------------------------------------------------------- */
|
||||
.section .init_array, "aw"
|
||||
|
Loading…
Reference in New Issue
Block a user