Alexey Khromov 6 months ago
parent 097b39faa7
commit 0b2630f624

@ -14,6 +14,8 @@
#include "includes.h" #include "includes.h"
#include "confread.h" #include "confread.h"
#include "logger.h" #include "logger.h"
#include <unistd.h>
#include <stdio.h>
struct { struct {
char *name; char *name;
@ -75,17 +77,16 @@ int exec_options_parse(char *str)
void exec_options_init(s_exec_options *eopt) void exec_options_init(s_exec_options *eopt)
{ {
char ** env; int i = 0;
int i;
memset(eopt, '\0', sizeof(s_exec_options)); memset(eopt, '\0', sizeof(s_exec_options));
eopt->umask = EXEC_DEFAULT_UMASK; eopt->umask = EXEC_DEFAULT_UMASK;
env = environ;
eopt->envp[0] = NULL; eopt->envp[0] = NULL;
for (i=0; env[i]; i++) {
log("EXEC: Added ENV variable: %s\n", env[i]); while(environ[i]) {
eopt->envp[i] = xmalloc(strlen(env[i]) + 2); log("EXEC: Added ENV variable: %s\n", environ[i]);
sprintf(eopt->envp[i], env[i]); eopt->envp[i] = xmalloc(strlen(environ[i]) + 2);
eopt->envp[i+1] = NULL; sprintf(eopt->envp[i], environ[i++]);
eopt->envp[i] = NULL;
} }
} }

Loading…
Cancel
Save