Minor fixes of Wunused_var, environment copy on subprocess creation
This commit is contained in:
@@ -26,6 +26,8 @@ struct {
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
extern char **environ;
|
||||
|
||||
int exec_file_exist(const char *command)
|
||||
{
|
||||
const char *p;
|
||||
@@ -73,9 +75,19 @@ int exec_options_parse(char *str)
|
||||
|
||||
void exec_options_init(s_exec_options *eopt)
|
||||
{
|
||||
char ** env;
|
||||
int i;
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void exec_options_deinit(s_exec_options *eopt)
|
||||
|
||||
Reference in New Issue
Block a user