main: move signal handler setting to util.c
This commit is contained in:
parent
2d581a6a86
commit
ceef8ad2d8
3 changed files with 18 additions and 6 deletions
8
main.c
8
main.c
|
@ -51,6 +51,7 @@
|
||||||
#include "nameserv.h"
|
#include "nameserv.h"
|
||||||
#include "smooth.h"
|
#include "smooth.h"
|
||||||
#include "tempcomp.h"
|
#include "tempcomp.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
|
|
||||||
|
@ -522,12 +523,7 @@ int main
|
||||||
post_init_rtc_hook(NULL);
|
post_init_rtc_hook(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
signal(SIGINT, signal_cleanup);
|
UTI_SetQuitSignalsHandler(signal_cleanup);
|
||||||
signal(SIGTERM, signal_cleanup);
|
|
||||||
#if !defined(WINNT)
|
|
||||||
signal(SIGQUIT, signal_cleanup);
|
|
||||||
signal(SIGHUP, signal_cleanup);
|
|
||||||
#endif /* WINNT */
|
|
||||||
|
|
||||||
/* The program normally runs under control of the main loop in
|
/* The program normally runs under control of the main loop in
|
||||||
the scheduler. */
|
the scheduler. */
|
||||||
|
|
14
util.c
14
util.c
|
@ -839,3 +839,17 @@ UTI_DecodePasswordFromText(char *key)
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ================================================== */
|
||||||
|
|
||||||
|
int
|
||||||
|
UTI_SetQuitSignalsHandler(void (*handler)(int))
|
||||||
|
{
|
||||||
|
signal(SIGINT, handler);
|
||||||
|
signal(SIGTERM, handler);
|
||||||
|
#if !defined(WINNT)
|
||||||
|
signal(SIGQUIT, handler);
|
||||||
|
signal(SIGHUP, handler);
|
||||||
|
#endif /* WINNT */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
2
util.h
2
util.h
|
@ -127,4 +127,6 @@ extern int UTI_CheckNTPAuth(int hash_id, const unsigned char *key, int key_len,
|
||||||
/* Decode password encoded in ASCII or HEX */
|
/* Decode password encoded in ASCII or HEX */
|
||||||
extern int UTI_DecodePasswordFromText(char *key);
|
extern int UTI_DecodePasswordFromText(char *key);
|
||||||
|
|
||||||
|
extern int UTI_SetQuitSignalsHandler(void (*handler)(int));
|
||||||
|
|
||||||
#endif /* GOT_UTIL_H */
|
#endif /* GOT_UTIL_H */
|
||||||
|
|
Loading…
Reference in a new issue