#define OUT_PY_LOG "lutf_py.log"
#define LARGE_LOG_FILE 400000000 /* 400 MB */
-time_t debugnow;
-int di;
-char debugtimestr[30];
-
static inline void lutf_log_print(bool error, char *color1, char *color2,
char *file, int line, char *fmt, ...)
{
*/
} lutf_config_params_t;
-lutf_config_params_t g_lutf_cfg;
+extern lutf_config_params_t g_lutf_cfg;
static inline const char *lutf_rc2str(lutf_rc_t rc)
{
memcpy(&master->addr,
&info->hb_info.master_address,
sizeof(master->addr));
- strncpy(master->name, g_lutf_cfg.master_name,
- MAX_STR_LEN);
- master->name[MAX_STR_LEN-1] = '\0';
+ if (g_lutf_cfg.master_name) {
+ strncpy(master->name, g_lutf_cfg.master_name,
+ MAX_STR_LEN);
+ master->name[MAX_STR_LEN-1] = '\0';
+ }
master->node_type = EN_LUTF_MASTER;
gethostname(master->hostname, MAX_STR_LEN);
master->telnet_port = info->hb_info.agent_telnet_port;
PyRun_SimpleString("import readline\n");
/* all other paths are figured out within python */
- snprintf(buf, MAX_STR_LEN,
+ snprintf(buf, sizeof(buf),
"sys.path.append(os.path.join('%s', 'python', 'infra'))",
- g_lutf_cfg.lutf_path);
+ g_lutf_cfg.lutf_path ? : "NULL");
PyRun_SimpleString(buf);
- snprintf(buf, MAX_STR_LEN,
+ snprintf(buf, sizeof(buf),
"sys.path.append(\"%s/src\")\n",
- g_lutf_cfg.lutf_path);
+ g_lutf_cfg.lutf_path ? : "NULL");
PyRun_SimpleString(buf);
while (more != NULL) {
*/
PDEBUG("Running in Daemon mode");
sprintf(segment, "fname = os.path.join('%s', '%s')\n",
- g_lutf_cfg.tmp_dir, OUT_PY_LOG);
+ g_lutf_cfg.tmp_dir ? : "NULL", OUT_PY_LOG);
if (PyRun_SimpleString(segment)) {
PERROR("Failed to create log file");
rc = EN_LUTF_RC_FAIL;