From 351c92dfba3050c07603b933dd2770fbe7ca67c4 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Wed, 16 Oct 2019 13:53:22 -0700 Subject: [PATCH] sesman: fix for sesman startup without startup script --- sesman/config.c | 19 ------------------- sesman/sesman.c | 32 +++++++++++++++++++++----------- 2 files changed, 21 insertions(+), 30 deletions(-) diff --git a/sesman/config.c b/sesman/config.c index ebadfd83..c508dfa3 100644 --- a/sesman/config.c +++ b/sesman/config.c @@ -51,16 +51,6 @@ config_read(struct config_sesman *cfg) if (-1 == fd) { - //if (g_cfg->log.fd >= 0) - //{ - /* logging is already active */ - log_message(LOG_LEVEL_ALWAYS, "error opening %s in \ - config_read", cfg_file); - //} - //else - //{ - g_printf("error opening %s in config_read", cfg_file); - //} return 1; } @@ -212,15 +202,6 @@ config_read_globals(int file, struct config_sesman *cf, struct list *param_n, g_free(buf); } - log_message(LOG_LEVEL_TRACE, "config loaded in %s at %s:%d", __func__, __FILE__, __LINE__); - log_message(LOG_LEVEL_TRACE, " listen_address = %s", cf->listen_address); - log_message(LOG_LEVEL_TRACE, " listen_port = %s", cf->listen_port); - log_message(LOG_LEVEL_TRACE, " enable_user_wm = %d", cf->enable_user_wm); - log_message(LOG_LEVEL_TRACE, " default_wm = %s", cf->default_wm); - log_message(LOG_LEVEL_TRACE, " user_wm = %s", cf->user_wm); - log_message(LOG_LEVEL_TRACE, " reconnect_sh = %s", cf->reconnect_sh); - log_message(LOG_LEVEL_TRACE, " auth_file_path = %s", cf->auth_file_path); - return 0; } diff --git a/sesman/sesman.c b/sesman/sesman.c index 7aa098fc..73c7d0a2 100644 --- a/sesman/sesman.c +++ b/sesman/sesman.c @@ -342,12 +342,33 @@ main(int argc, char **argv) g_exit(1); } + log_message(LOG_LEVEL_TRACE, "config loaded in %s at %s:%d", __func__, __FILE__, __LINE__); + log_message(LOG_LEVEL_TRACE, " listen_address = %s", g_cfg->listen_address); + log_message(LOG_LEVEL_TRACE, " listen_port = %s", g_cfg->listen_port); + log_message(LOG_LEVEL_TRACE, " enable_user_wm = %d", g_cfg->enable_user_wm); + log_message(LOG_LEVEL_TRACE, " default_wm = %s", g_cfg->default_wm); + log_message(LOG_LEVEL_TRACE, " user_wm = %s", g_cfg->user_wm); + log_message(LOG_LEVEL_TRACE, " reconnect_sh = %s", g_cfg->reconnect_sh); + log_message(LOG_LEVEL_TRACE, " auth_file_path = %s", g_cfg->auth_file_path); + if (daemon) { /* not to spit on the console, shut up stdout/stderr before anything's logged */ g_file_close(0); g_file_close(1); g_file_close(2); + + if (g_file_open("/dev/null") < 0) + { + } + + if (g_file_open("/dev/null") < 0) + { + } + + if (g_file_open("/dev/null") < 0) + { + } } /* libscp initialization */ @@ -372,17 +393,6 @@ main(int argc, char **argv) g_exit(0); } - if (g_file_open("/dev/null") < 0) - { - } - - if (g_file_open("/dev/null") < 0) - { - } - - if (g_file_open("/dev/null") < 0) - { - } } /* signal handling */