Alexey Khromov 8 months ago
parent 097b39faa7
commit 0b2630f624

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

Loading…
Cancel
Save