|
|
@ -20,8 +20,6 @@
|
|
|
|
#include "nodelist.h"
|
|
|
|
#include "nodelist.h"
|
|
|
|
#include "session.h"
|
|
|
|
#include "session.h"
|
|
|
|
|
|
|
|
|
|
|
|
char ** sessenv;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* PID of our child process (if use fork) */
|
|
|
|
/* PID of our child process (if use fork) */
|
|
|
|
pid_t child_pid = 0;
|
|
|
|
pid_t child_pid = 0;
|
|
|
|
|
|
|
|
|
|
|
@ -256,10 +254,6 @@ int main(int argc, char *argv[], char *envp[])
|
|
|
|
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));
|
|
|
|
|
|
|
|
|
|
|
|
// parsing
|
|
|
|
// parsing
|
|
|
@ -467,21 +461,6 @@ int main(int argc, char *argv[], char *envp[])
|
|
|
|
//snprintf(runmode_str, 20, "Run mode: %d", opts.runmode);
|
|
|
|
//snprintf(runmode_str, 20, "Run mode: %d", opts.runmode);
|
|
|
|
//log(runmode_str);
|
|
|
|
//log(runmode_str);
|
|
|
|
|
|
|
|
|
|
|
|
/* Init environment table for childs */
|
|
|
|
|
|
|
|
argsz = 4096;
|
|
|
|
|
|
|
|
//argsz = sysconf(_SC_ARG_MAX);
|
|
|
|
|
|
|
|
DEB((D_CONFIG, "Limits: %d\n",argsz));
|
|
|
|
|
|
|
|
sessenv = malloc(sizeof(sessenv)*argsz);
|
|
|
|
|
|
|
|
sessenv[0] = NULL;
|
|
|
|
|
|
|
|
i=0;
|
|
|
|
|
|
|
|
while (envp[i]) {
|
|
|
|
|
|
|
|
sessenv[i] = malloc(strlen(envp[i])+2);
|
|
|
|
|
|
|
|
strcpy(sessenv[i], envp[i]);
|
|
|
|
|
|
|
|
sessenv[i++] = NULL;
|
|
|
|
|
|
|
|
DEB((D_FREE, "session ENV: %s\n", sessenv[(i-1)]));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch( opts.runmode )
|
|
|
|
switch( opts.runmode )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case MODE_DAEMON:
|
|
|
|
case MODE_DAEMON:
|
|
|
@ -509,14 +488,6 @@ default:
|
|
|
|
|
|
|
|
|
|
|
|
exit:
|
|
|
|
exit:
|
|
|
|
|
|
|
|
|
|
|
|
/* de-init sessenv */
|
|
|
|
|
|
|
|
i=0;
|
|
|
|
|
|
|
|
while(sessenv[i]) {
|
|
|
|
|
|
|
|
DEB((D_FREE, "De-init session ENV: %s\n", sessenv[(i)]));
|
|
|
|
|
|
|
|
free(sessenv[i]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
free(sessenv);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deinit_conf();
|
|
|
|
deinit_conf();
|
|
|
|
deinit_opts(&opts);
|
|
|
|
deinit_opts(&opts);
|
|
|
|
|
|
|
|
|
|
|
|