mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 17:35:06 -05:00
Wait in foreground process until daemon is fully initialized
Exit when all sockets are ready and initstepslew command and rtc step are completed. Also, in case of a fatal error, print the error message and exit with a non-zero status.
This commit is contained in:
22
logging.c
22
logging.c
@@ -41,6 +41,8 @@ static int initialised = 0;
|
||||
|
||||
static int system_log = 0;
|
||||
|
||||
static int parent_fd = 0;
|
||||
|
||||
static time_t last_limited = 0;
|
||||
|
||||
#ifdef WINNT
|
||||
@@ -154,6 +156,9 @@ LOG_Fatal_Function(LOG_Facility facility, const char *format, ...)
|
||||
} else {
|
||||
fprintf(stderr, "Fatal error : %s\n", buf);
|
||||
}
|
||||
if (parent_fd) {
|
||||
write(parent_fd, buf, strlen(buf) + 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
MAI_CleanupAndExit();
|
||||
@@ -196,6 +201,23 @@ LOG_OpenSystemLog(void)
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
void
|
||||
LOG_SetParentFd(int fd)
|
||||
{
|
||||
parent_fd = fd;
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
void
|
||||
LOG_CloseParentFd()
|
||||
{
|
||||
if (parent_fd > 0)
|
||||
close(parent_fd);
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
int
|
||||
LOG_RateLimited(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user