[tuxdroid-svn] r232 - svnlook: warning: cannot set LC_CTYPE locale svnlook: warning: environment va
Status: Beta
Brought to you by:
ks156
From: svnlook:warning@affinitic.be:cannot s. L. l. <c2m...@c2...> - 2007-04-09 08:51:34
|
Author: svnlook: warning: cannot set LC_CTYPE locale Date: svnlook: warning: environment variable LANG is EN New Revision: 232 Modified: daemon/trunk/main.c Log: neimad 2007-04-09 10:51:30 +0200 (Mon, 09 Apr 2007) 31 * Yet more coding style fixes. svnlook: warning: cannot set LC_CTYPE locale svnlook: warning: environment variable LANG is EN svnlook: warning: please check that your locale name is correct Modified: daemon/trunk/main.c =================================================================== --- daemon/trunk/main.c 2007-04-09 08:49:16 UTC (rev 231) +++ daemon/trunk/main.c 2007-04-09 08:51:30 UTC (rev 232) @@ -93,20 +93,21 @@ /************************************************************************ */ /* Clean closing of STD IN-OUT FILENO*/ /************************************************************************ */ -static int fd_nullify (int desired_fd) +static int fd_nullify(int desired_fd) { int fd; int fd2; int saved_errno; - close (desired_fd); - fd = open ("/dev/null", O_WRONLY, S_IRUSR | S_IWUSR); + close(desired_fd); + fd = open("/dev/null", O_WRONLY, S_IRUSR | S_IWUSR); if (fd == desired_fd || fd < 0) return fd; - else { - fd2 = fcntl (fd, F_DUPFD, desired_fd); + else + { + fd2 = fcntl(fd, F_DUPFD, desired_fd); saved_errno = errno; - close (fd); + close(fd); errno = saved_errno; return fd2; } @@ -130,6 +131,7 @@ default : exit(0); } + umask(0); sid = setsid(); if (sid < 0) @@ -137,13 +139,16 @@ perror("sid"); exit(1); } + if (chdir("/") < 0) { perror("chdir"); exit(1); } + daemon_pid = (unsigned short)getpid(); printf("Tux USB Daemon started : pid = %d\n", (int)getpid()); + /* No shell */ if (!shell_view) { @@ -208,8 +213,10 @@ } } } + if (daemonized) daemonize(shell_view); + /* Print daemon informations */ print_info_daemon(); @@ -221,6 +228,7 @@ /* On exiting */ signal(SIGINT, on_close_daemon); signal(SIGKILL, on_close_daemon); + /* Gestion Multithread */ if (!g_thread_supported()) { @@ -233,19 +241,25 @@ } /* Start USB task thread */ - if ((UsbThread = g_thread_create((GThreadFunc)usb_start_task, NULL, TRUE, &error)) == NULL ) + UsbThread = g_thread_create((GThreadFunc)usb_start_task, NULL, TRUE, + &error); + if (UsbThread == NULL) { printf("Thread creation failed: %s \n", error->message); return 2; } /* Start TCP task thread */ - if ((TcpThread = g_thread_create((GThreadFunc)tcp_server_start_task, NULL, TRUE, &error)) == NULL ) + TcpThread = g_thread_create((GThreadFunc)tcp_server_start_task, NULL, TRUE, + &error); + if (TcpThread == NULL) { printf("Thread creation failed: %s \n", error->message); return 2; } + loop = g_main_loop_new(NULL, FALSE); g_main_loop_run(loop); + return 0; } |