Skip to content

Commit

Permalink
bin: Fix build on non-Windows
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 authored and edsiper committed Oct 2, 2023
1 parent 7877d13 commit 14cfcdb
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/fluent-bit.c
Original file line number Diff line number Diff line change
Expand Up @@ -550,15 +550,14 @@ static void flb_signal_exit(int signal)
};
}

static void flb_signal_handler_status_line()
static void flb_signal_handler_status_line(struct flb_cf *cf_opts)
{
int len;
char ts[32];
char s[] = "[engine] caught signal (";
time_t now;
struct tm *cur;
flb_ctx_t *ctx = flb_context_get();
struct flb_cf *cf_opts = flb_cf_context_get();

now = time(NULL);
cur = localtime(&now);
Expand All @@ -577,7 +576,8 @@ static void flb_signal_handler_status_line()

static void flb_signal_handler(int signal)
{
flb_signal_handler_status_line();
struct flb_cf *cf_opts = flb_cf_context_get();
flb_signal_handler_status_line(cf_opts);

switch (signal) {
flb_print_signal(SIGINT);
Expand Down Expand Up @@ -637,9 +637,12 @@ void flb_console_handler_set_ctx(flb_ctx_t *ctx, struct flb_cf *cf_opts)

static BOOL WINAPI flb_console_handler(DWORD evType)
{
struct flb_cf *cf_opts;

switch(evType) {
case 0 /* CTRL_C_EVENT_0 */:
flb_signal_handler_status_line();
cf_opts = flb_cf_context_get();
flb_signal_handler_status_line(cf_opts);
write (STDERR_FILENO, "SIGINT)\n", sizeof("SIGINT)\n")-1);
/* signal the main loop to execute reload even if CTRL_C event.
* This is necessary because all signal handlers in win32
Expand Down

0 comments on commit 14cfcdb

Please sign in to comment.