[tuxdroid-svn] r332 - daemon/trunk
Status: Beta
Brought to you by:
ks156
From: jaguarondi <c2m...@c2...> - 2007-05-31 12:13:34
|
Author: jaguarondi Date: 2007-05-31 14:13:32 +0200 (Thu, 31 May 2007) New Revision: 332 Modified: daemon/trunk/main.c Log: - CHG: pid file is only written in daemon mode, it is now possible to launch tuxdaemon as a non-root user if you don't daemonize it. Modified: daemon/trunk/main.c =================================================================== --- daemon/trunk/main.c 2007-05-31 09:02:10 UTC (rev 331) +++ daemon/trunk/main.c 2007-05-31 12:13:32 UTC (rev 332) @@ -55,6 +55,7 @@ unsigned char show_raw_status = 0; unsigned char show_invalid_raw = 0; unsigned short daemon_pid = 0; +unsigned char daemonized = 0; /************************************************************************ */ @@ -133,10 +134,10 @@ { send_daemon_disconnected(); - if (remove_pid()) + if (daemonized && remove_pid()) log_error("Could not delete PID file"); - log_info("terminated"); + log_info("tuxdaemon stopped"); log_close(); } @@ -275,7 +276,6 @@ unsigned char i; log_target_t log_target = LOG_TARGET_SYSLOG; log_level_t log_level = LOG_LEVEL_INFO; - unsigned char daemonized = 0; /* On exiting */ signal(SIGINT, quit_handler); @@ -311,10 +311,10 @@ } } - /* Only one instance of the daemon is authorized */ + /* Only one instance of the daemon is allowed */ if (check_pid()) { - printf("Tuxdaemon is already launched !\n"); + printf("tuxdaemon is already running!\n"); exit(0); } @@ -327,9 +327,6 @@ log_open(LOG_TARGET_SHELL); log_set_level(log_level); - - if (!write_pid()) - exit(1); } /* Setup & print daemon information */ |