projects
/
apps
/
pfixtools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Version 0.4
[apps/pfixtools.git]
/
common
/
common.c
diff --git
a/common/common.c
b/common/common.c
index
9fdf961
..
1b8cd98
100644
(file)
--- a/
common/common.c
+++ b/
common/common.c
@@
-41,9
+41,10
@@
#include "common.h"
#include "common.h"
-bool daemon_process = true;
-int log_level = LOG_INFO;
-bool log_syslog = false;
+bool daemon_process = true;
+int log_level = LOG_INFO;
+bool log_syslog = false;
+const char *log_state = "";
static FILE *pidfile = NULL;
static FILE *pidfile = NULL;
@@
-286,15
+287,16
@@
ARRAY(exitcall_t)
static A(exitcall_t) __exit = ARRAY_INIT;
static A(exitcall_t) __exit = ARRAY_INIT;
-void common_register_exit(exitcall_t
_exit
)
+void common_register_exit(exitcall_t
exitcall
)
{
{
- array_add(__exit,
_exit
);
+ array_add(__exit,
exitcall
);
}
static void common_shutdown(void)
{
}
static void common_shutdown(void)
{
+ log_state = "stopping ";
if (daemon_process && log_syslog) {
if (daemon_process && log_syslog) {
- info("
stopping...
");
+ info("");
}
pidfile_close();
for (int i = array_len(__exit) - 1 ; i >= 0 ; --i) {
}
pidfile_close();
for (int i = array_len(__exit) - 1 ; i >= 0 ; --i) {
@@
-309,6
+311,7
@@
void common_init(void)
if (__ran) {
return;
}
if (__ran) {
return;
}
+ log_state = "starting ";
if (atexit(common_shutdown)) {
fputs("Cannot hook my atexit function, quitting !\n", stderr);
abort();
if (atexit(common_shutdown)) {
fputs("Cannot hook my atexit function, quitting !\n", stderr);
abort();