minor fixes and indent

ulab-original
jsorg71 19 years ago
parent 5603962061
commit 8c73bc31cb

@ -44,7 +44,7 @@ env_check_password_file(char* filename, char* password)
rfbDesKey(g_fixedkey, 0); rfbDesKey(g_fixedkey, 0);
rfbDes((unsigned char*)encryptedPasswd, (unsigned char*)encryptedPasswd); rfbDes((unsigned char*)encryptedPasswd, (unsigned char*)encryptedPasswd);
fd = g_file_open(filename); fd = g_file_open(filename);
if (fd == 0) if (fd == -1)
{ {
log_message(LOG_LEVEL_WARNING, "can't read vnc password file - %s", log_message(LOG_LEVEL_WARNING, "can't read vnc password file - %s",
filename); filename);

@ -41,7 +41,7 @@ extern int thread_sck;
* *
*/ */
static void DEFAULT_CC static void DEFAULT_CC
sesman_main_loop() sesman_main_loop(void)
{ {
int in_sck; int in_sck;
int error; int error;
@ -112,7 +112,7 @@ main(int argc, char** argv)
{ {
/* starts sesman not daemonized */ /* starts sesman not daemonized */
g_printf("starting sesman in foregroud...\n"); g_printf("starting sesman in foregroud...\n");
daemon=0; daemon = 0;
} }
else if ((2 == argc) && ((0 == g_strcasecmp(argv[1], "--help")) || else if ((2 == argc) && ((0 == g_strcasecmp(argv[1], "--help")) ||
(0 == g_strcasecmp(argv[1], "-h")))) (0 == g_strcasecmp(argv[1], "-h"))))
@ -205,17 +205,17 @@ main(int argc, char** argv)
} }
g_exit(1); g_exit(1);
} }
if (daemon) if (daemon)
{ {
/* start of daemonizing code */ /* start of daemonizing code */
g_pid = g_fork(); g_pid = g_fork();
if (0!=g_pid) if (0 != g_pid)
{ {
g_exit(0); g_exit(0);
} }
g_file_close(0); g_file_close(0);
g_file_close(1); g_file_close(1);
g_file_close(2); g_file_close(2);
@ -227,7 +227,7 @@ main(int argc, char** argv)
/* initializing locks */ /* initializing locks */
lock_init(); lock_init();
/* signal handling */ /* signal handling */
g_pid = g_getpid(); g_pid = g_getpid();
/* old style signal handling is now managed synchronously by a /* old style signal handling is now managed synchronously by a
@ -252,7 +252,7 @@ main(int argc, char** argv)
g_exit(1); g_exit(1);
} }
g_sprintf(pid_s, "%d", g_pid); 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); g_file_close(fd);
/* start program main loop */ /* start program main loop */

@ -101,13 +101,13 @@ sig_handler_thread(void* arg)
sigset_t sigmask; sigset_t sigmask;
sigset_t oldmask; sigset_t oldmask;
sigset_t waitmask; sigset_t waitmask;
/* mask signals to be able to wait for them... */ /* mask signals to be able to wait for them... */
sigfillset(&sigmask); sigfillset(&sigmask);
/* it is a good idea not to block SIGILL SIGSEGV */ /* it is a good idea not to block SIGILL SIGSEGV */
/* SIGFPE -- see sigaction(2) NOTES */ /* SIGFPE -- see sigaction(2) NOTES */
pthread_sigmask(SIG_BLOCK, &sigmask, &oldmask); pthread_sigmask(SIG_BLOCK, &sigmask, &oldmask);
/* building the signal wait mask... */ /* building the signal wait mask... */
sigemptyset(&waitmask); sigemptyset(&waitmask);
sigaddset(&waitmask, SIGHUP); sigaddset(&waitmask, SIGHUP);
@ -116,7 +116,7 @@ sig_handler_thread(void* arg)
// sigaddset(&waitmask, SIGFPE); // sigaddset(&waitmask, SIGFPE);
// sigaddset(&waitmask, SIGILL); // sigaddset(&waitmask, SIGILL);
// sigaddset(&waitmask, SIGSEGV); // sigaddset(&waitmask, SIGSEGV);
do do
{ {
LOG_DBG("calling sigwait()",0); LOG_DBG("calling sigwait()",0);
@ -126,27 +126,27 @@ sig_handler_thread(void* arg)
{ {
case SIGHUP: case SIGHUP:
//reload cfg //reload cfg
LOG_DBG("sesman received SIGHUP",0); LOG_DBG("sesman received SIGHUP",0);
//return 0; //return 0;
break; break;
case SIGCHLD: case SIGCHLD:
/* a session died */ /* a session died */
LOG_DBG("sesman received SIGCHLD",0); LOG_DBG("sesman received SIGCHLD",0);
sig_sesman_session_end(SIGCHLD); sig_sesman_session_end(SIGCHLD);
break; break;
/*case SIGKILL; /*case SIGKILL;
/* we die * / /* we die * /
LOG_DBG("sesman received SIGKILL",0); LOG_DBG("sesman received SIGKILL",0);
sig_sesman_shutdown(recv_signal); sig_sesman_shutdown(recv_signal);
break;*/ break;*/
case SIGTERM: case SIGTERM:
/* we die */ /* we die */
LOG_DBG("sesman received SIGTERM",0); LOG_DBG("sesman received SIGTERM",0);
sig_sesman_shutdown(recv_signal); sig_sesman_shutdown(recv_signal);
break; break;
} }
} while (1); } while (1);
return 0; return 0;
} }

@ -39,7 +39,7 @@ int thread_sck;
/******************************************************************************/ /******************************************************************************/
int DEFAULT_CC int DEFAULT_CC
thread_sighandler_start() thread_sighandler_start(void)
{ {
int ret; int ret;
sigset_t sigmask; sigset_t sigmask;
@ -61,11 +61,11 @@ thread_sighandler_start()
pthread_sigmask(SIG_UNBLOCK, &waitmask, NULL); pthread_sigmask(SIG_UNBLOCK, &waitmask, NULL);
log_message(LOG_LEVEL_INFO,"starting signal handling thread..."); log_message(LOG_LEVEL_INFO,"starting signal handling thread...");
ret = pthread_create(&thread_sighandler, NULL, sig_handler_thread, ""); ret = pthread_create(&thread_sighandler, NULL, sig_handler_thread, "");
pthread_detach(thread_sighandler); pthread_detach(thread_sighandler);
if (ret==0) if (ret == 0)
{ {
log_message(LOG_LEVEL_INFO, "signal handler thread started successfully"); log_message(LOG_LEVEL_INFO, "signal handler thread started successfully");
return 0; return 0;
@ -93,7 +93,7 @@ thread_sighandler_start()
#ifdef JUST_TO_AVOID_COMPILER_ERRORS #ifdef JUST_TO_AVOID_COMPILER_ERRORS
/******************************************************************************/ /******************************************************************************/
int DEFAULT_CC int DEFAULT_CC
thread_session_update_start() thread_session_update_start(void)
{ {
int ret; int ret;
//starts the session update thread //starts the session update thread
@ -140,13 +140,13 @@ thread_scp_start(int skt)
/* blocking the use of thread_skt */ /* blocking the use of thread_skt */
lock_socket_acquire(); lock_socket_acquire();
thread_sck=skt; thread_sck=skt;
/* start a thread that processes a connection */ /* start a thread that processes a connection */
ret = pthread_create(&th, NULL, scp_process_start, ""); ret = pthread_create(&th, NULL, scp_process_start, "");
//ret = pthread_create(&th, NULL, scp_process_start, (void*) (&thread_sck)); //ret = pthread_create(&th, NULL, scp_process_start, (void*) (&thread_sck));
pthread_detach(th); pthread_detach(th);
if (ret==0) if (ret == 0)
{ {
log_message(LOG_LEVEL_INFO, "scp thread on sck %d started successfully", skt); log_message(LOG_LEVEL_INFO, "scp thread on sck %d started successfully", skt);
return 0; return 0;

Loading…
Cancel
Save