Compare commits
No commits in common. "d010e16b1592b82a86b0716af166c97cceb37d36" and "bcf0d456eecc0e31f0dd576e24331e8e23e8ec16" have entirely different histories.
d010e16b15
...
bcf0d456ee
@ -54,9 +54,6 @@ const char *BFERR[] = {
|
|||||||
/* 27 */ "Unused entry"
|
/* 27 */ "Unused entry"
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Main environment on startup (copied) for external processes */
|
|
||||||
char ** mainenv;
|
|
||||||
|
|
||||||
static void deinit_opts(s_bforce_opts *opts);
|
static void deinit_opts(s_bforce_opts *opts);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -256,25 +253,9 @@ int main(int argc, char *argv[], char *envp[])
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
int ch = 0;
|
int ch = 0;
|
||||||
opts.runmode = MODE_UNDEFINED;
|
opts.runmode = MODE_UNDEFINED;
|
||||||
int i = 0;
|
|
||||||
int argsz = 0;
|
|
||||||
|
|
||||||
memset(&opts, '\0', sizeof(s_bforce_opts));
|
memset(&opts, '\0', sizeof(s_bforce_opts));
|
||||||
|
|
||||||
// Copying environment
|
|
||||||
argsz = 4096;
|
|
||||||
//argsz = sysconf(_SC_ARG_MAX);
|
|
||||||
DEB((D_CONFIG, "Limits: %d\n",argsz));
|
|
||||||
mainenv = malloc(sizeof(mainenv)*argsz);
|
|
||||||
mainenv[0] = NULL;
|
|
||||||
i=0;
|
|
||||||
while (envp[i]) {
|
|
||||||
mainenv[i] = malloc(strlen(envp[i])+2);
|
|
||||||
strcpy(mainenv[i], envp[i]);
|
|
||||||
mainenv[i++] = NULL;
|
|
||||||
DEB((D_FREE, "Program ENV: %s\n", mainenv[(i-1)]));
|
|
||||||
}
|
|
||||||
|
|
||||||
// parsing
|
// parsing
|
||||||
|
|
||||||
while( (ch=getopt(argc, argv, "hfI:p:n:l:a:u:oivC:S:dq")) != (int)-1 )
|
while( (ch=getopt(argc, argv, "hfI:p:n:l:a:u:oivC:S:dq")) != (int)-1 )
|
||||||
@ -507,15 +488,6 @@ default:
|
|||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
||||||
/* de-init sessenv */
|
|
||||||
i=0;
|
|
||||||
while(mainenv[i]) {
|
|
||||||
DEB((D_FREE, "De-init session ENV: %s\n", mainenv[(i)]));
|
|
||||||
free(mainenv[i]);
|
|
||||||
}
|
|
||||||
free(mainenv);
|
|
||||||
|
|
||||||
|
|
||||||
deinit_conf();
|
deinit_conf();
|
||||||
deinit_opts(&opts);
|
deinit_opts(&opts);
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ int conf_readconf(const char *confname, int inclevel, bool earlydbg)
|
|||||||
{
|
{
|
||||||
if (earlydbg)
|
if (earlydbg)
|
||||||
fprintf(stderr,"BF-DEBUG: can't open config file \"%s\"\n", confname);
|
fprintf(stderr,"BF-DEBUG: can't open config file \"%s\"\n", confname);
|
||||||
return(PROC_RC_ABORT);
|
return(PROC_RC_IGNORE);
|
||||||
}
|
}
|
||||||
if (earlydbg)
|
if (earlydbg)
|
||||||
fprintf(stderr,"BF-DEBUG: start reading config \"%s\"\n", confname);
|
fprintf(stderr,"BF-DEBUG: start reading config \"%s\"\n", confname);
|
||||||
|
@ -73,16 +73,9 @@ int exec_options_parse(char *str)
|
|||||||
|
|
||||||
void exec_options_init(s_exec_options *eopt)
|
void exec_options_init(s_exec_options *eopt)
|
||||||
{
|
{
|
||||||
int i = 0;
|
|
||||||
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;
|
||||||
while(mainenv[i]) {
|
|
||||||
log("EXEC: Added ENV variable: %s\n", mainenv[i]);
|
|
||||||
eopt->envp[i] = xmalloc(strlen(mainenv[i]) + 2);
|
|
||||||
sprintf(eopt->envp[i], mainenv[i++]);
|
|
||||||
eopt->envp[i] = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void exec_options_deinit(s_exec_options *eopt)
|
void exec_options_deinit(s_exec_options *eopt)
|
||||||
|
@ -183,6 +183,4 @@ extern const char *BFERR[];
|
|||||||
|
|
||||||
int daemon_run(const char *confname, const char *incname, bool quit);
|
int daemon_run(const char *confname, const char *incname, bool quit);
|
||||||
|
|
||||||
extern char ** mainenv;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user