diff options
| author | Michal Idziorek <m.i@gmx.at> | 2014-11-24 02:54:32 +0100 |
|---|---|---|
| committer | Michal Idziorek <m.i@gmx.at> | 2014-11-24 02:54:32 +0100 |
| commit | 48abbcee80a5066159b8ffee5602728dd45b94e4 (patch) | |
| tree | 3f311fdd93c67000eb66c5525782d1bdcf70a494 /kernel | |
| parent | 369c62119b9dd60db77fc28e8857ed9c4d498889 (diff) | |
fixed ENV problem
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/syscalls.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/kernel/syscalls.c b/kernel/syscalls.c index b5422c5..941a8e3 100644 --- a/kernel/syscalls.c +++ b/kernel/syscalls.c @@ -199,13 +199,11 @@ int syscall_execve(char *name, char **argv, char **env) char **oldenviron=env; char **environ=0xf00001; - static bool first=true; - if(first) + if(oldenviron==0) { environ[0]=env1; environ[1]=env2; - environ[3]=NULL; - first=false; + environ[2]=NULL; } else { @@ -214,17 +212,17 @@ int syscall_execve(char *name, char **argv, char **env) int k=-1; while(oldenviron[i]!=NULL) { - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"copy env: %s (0x%08X)",oldenviron[i],oldenviron[i]); - int start=k+1; - int j=-1; - do{ + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"copy env: %s (0x%08X)",oldenviron[i],oldenviron[i]); + int start=k+1; + int j=-1; + do{ j++; k++; environstr[k]=oldenviron[i][j]; - }while(oldenviron[i][j]!=0); + }while(oldenviron[i][j]!=0); - environ[i]=&environstr[start]; - i++; + environ[i]=&environstr[start]; + i++; } environ[i]=NULL; @@ -392,6 +390,7 @@ uint32_t syscall_sbrk(int incr, int none1, int none2) int syscall_exit(int ret, char **env, int none2) { + asm("mov $0x07bff,%esp"); // set stack pointer #ifdef LOG_SYSCALLS log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"exit (ret=%d) (env=0x%08X)", ret, env); #endif |
