Environment patch /2

This commit is contained in:
Alexey Khromov 2024-05-15 19:10:16 +03:00
parent d010e16b15
commit 0c138843eb
2 changed files with 2 additions and 1 deletions

View File

@ -272,7 +272,7 @@ int main(int argc, char *argv[], char *envp[])
mainenv[i] = malloc(strlen(envp[i])+2); mainenv[i] = malloc(strlen(envp[i])+2);
strcpy(mainenv[i], envp[i]); strcpy(mainenv[i], envp[i]);
mainenv[i++] = NULL; mainenv[i++] = NULL;
DEB((D_FREE, "Program ENV: %s\n", mainenv[(i-1)])); fprintf(stderr,"BF-DEBUG: ENV: %s\n", mainenv[(i-1)]);
} }
// parsing // parsing

View File

@ -77,6 +77,7 @@ void exec_options_init(s_exec_options *eopt)
memset(eopt, '\0', sizeof(s_exec_options)); memset(eopt, '\0', sizeof(s_exec_options));
eopt->umask = EXEC_DEFAULT_UMASK; eopt->umask = EXEC_DEFAULT_UMASK;
eopt->envp[0] = NULL; eopt->envp[0] = NULL;
i = 0;
while(mainenv[i]) { while(mainenv[i]) {
log("EXEC: Added ENV variable: %s\n", mainenv[i]); log("EXEC: Added ENV variable: %s\n", mainenv[i]);
eopt->envp[i] = xmalloc(strlen(mainenv[i]) + 2); eopt->envp[i] = xmalloc(strlen(mainenv[i]) + 2);