diff --git a/sesman/env.c b/sesman/env.c index e96966fd..7c5ea86c 100644 --- a/sesman/env.c +++ b/sesman/env.c @@ -44,7 +44,7 @@ env_check_password_file(char* filename, char* password) rfbDesKey(g_fixedkey, 0); rfbDes((unsigned char*)encryptedPasswd, (unsigned char*)encryptedPasswd); fd = g_file_open(filename); - if (fd == 0) + if (fd == -1) { log_message(LOG_LEVEL_WARNING, "can't read vnc password file - %s", filename); diff --git a/sesman/sesman.c b/sesman/sesman.c index 7ea17414..0b6bf1b6 100644 --- a/sesman/sesman.c +++ b/sesman/sesman.c @@ -41,7 +41,7 @@ extern int thread_sck; * */ static void DEFAULT_CC -sesman_main_loop() +sesman_main_loop(void) { int in_sck; int error; @@ -112,7 +112,7 @@ main(int argc, char** argv) { /* starts sesman not daemonized */ g_printf("starting sesman in foregroud...\n"); - daemon=0; + daemon = 0; } else if ((2 == argc) && ((0 == g_strcasecmp(argv[1], "--help")) || (0 == g_strcasecmp(argv[1], "-h")))) @@ -205,17 +205,17 @@ main(int argc, char** argv) } g_exit(1); } - + if (daemon) { /* start of daemonizing code */ g_pid = g_fork(); - if (0!=g_pid) + if (0 != g_pid) { g_exit(0); } - + g_file_close(0); g_file_close(1); g_file_close(2); @@ -227,7 +227,7 @@ main(int argc, char** argv) /* initializing locks */ lock_init(); - + /* signal handling */ g_pid = g_getpid(); /* old style signal handling is now managed synchronously by a @@ -252,7 +252,7 @@ main(int argc, char** argv) g_exit(1); } g_sprintf(pid_s, "%d", g_pid); - g_file_write(fd, pid_s, g_strlen(pid_s)+1); + g_file_write(fd, pid_s, g_strlen(pid_s) + 1); g_file_close(fd); /* start program main loop */ diff --git a/sesman/sig.c b/sesman/sig.c index fc702bb6..8527f60a 100644 --- a/sesman/sig.c +++ b/sesman/sig.c @@ -101,13 +101,13 @@ sig_handler_thread(void* arg) sigset_t sigmask; sigset_t oldmask; sigset_t waitmask; - + /* mask signals to be able to wait for them... */ sigfillset(&sigmask); /* it is a good idea not to block SIGILL SIGSEGV */ /* SIGFPE -- see sigaction(2) NOTES */ pthread_sigmask(SIG_BLOCK, &sigmask, &oldmask); - + /* building the signal wait mask... */ sigemptyset(&waitmask); sigaddset(&waitmask, SIGHUP); @@ -116,7 +116,7 @@ sig_handler_thread(void* arg) // sigaddset(&waitmask, SIGFPE); // sigaddset(&waitmask, SIGILL); // sigaddset(&waitmask, SIGSEGV); - + do { LOG_DBG("calling sigwait()",0); @@ -126,27 +126,27 @@ sig_handler_thread(void* arg) { case SIGHUP: //reload cfg - LOG_DBG("sesman received SIGHUP",0); - //return 0; + LOG_DBG("sesman received SIGHUP",0); + //return 0; break; case SIGCHLD: /* a session died */ - LOG_DBG("sesman received SIGCHLD",0); + LOG_DBG("sesman received SIGCHLD",0); sig_sesman_session_end(SIGCHLD); break; /*case SIGKILL; /* we die * / LOG_DBG("sesman received SIGKILL",0); - sig_sesman_shutdown(recv_signal); + sig_sesman_shutdown(recv_signal); break;*/ case SIGTERM: /* we die */ LOG_DBG("sesman received SIGTERM",0); - sig_sesman_shutdown(recv_signal); + sig_sesman_shutdown(recv_signal); break; } } while (1); - + return 0; } diff --git a/sesman/thread.c b/sesman/thread.c index 46960b7a..0f6f3c8c 100644 --- a/sesman/thread.c +++ b/sesman/thread.c @@ -39,7 +39,7 @@ int thread_sck; /******************************************************************************/ int DEFAULT_CC -thread_sighandler_start() +thread_sighandler_start(void) { int ret; sigset_t sigmask; @@ -61,11 +61,11 @@ thread_sighandler_start() pthread_sigmask(SIG_UNBLOCK, &waitmask, NULL); log_message(LOG_LEVEL_INFO,"starting signal handling thread..."); - + ret = pthread_create(&thread_sighandler, NULL, sig_handler_thread, ""); pthread_detach(thread_sighandler); - - if (ret==0) + + if (ret == 0) { log_message(LOG_LEVEL_INFO, "signal handler thread started successfully"); return 0; @@ -93,7 +93,7 @@ thread_sighandler_start() #ifdef JUST_TO_AVOID_COMPILER_ERRORS /******************************************************************************/ int DEFAULT_CC -thread_session_update_start() +thread_session_update_start(void) { int ret; //starts the session update thread @@ -140,13 +140,13 @@ thread_scp_start(int skt) /* blocking the use of thread_skt */ lock_socket_acquire(); thread_sck=skt; - + /* start a thread that processes a connection */ ret = pthread_create(&th, NULL, scp_process_start, ""); //ret = pthread_create(&th, NULL, scp_process_start, (void*) (&thread_sck)); pthread_detach(th); - if (ret==0) + if (ret == 0) { log_message(LOG_LEVEL_INFO, "scp thread on sck %d started successfully", skt); return 0;