scheduler: fix problem with SIGSEGV on FreeBSD 12+ (#2781)
scheduler: fix problem with SIGSEGV on FreeBSD 12+ (#2781)

This is related to https://github.com/fluent/fluent-bit/pull/2463 for MacOS.

In flb_pipe_r() function is returning 0 on FreeBSD 12+ and that brings up
errors similar to "[error] [src/flb_scheduler.c:52 errno=0] No error: 0". This
patch will fix it the same way as it was previously fixed for MacOS.

This patch was tested on FreeBSD 11.4 and 12.2 amd64.  The resulting binaries
was tested with "elfdump -a" to contain only one ".text" section and their
startup logs were tested running "fluent-bit -v -i dummy -o stdout".

See also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=250825
Submitted by: Yuri Pankov and Artyom Davidov
Signed-off-by: Palle Girgensohn <ce4b071d85a26a3927ff8f8418bc1b8fa3e9b24f@FreeBSD.org>

Co-authored-by: Palle Girgensohn <ce4b071d85a26a3927ff8f8418bc1b8fa3e9b24f@FreeBSD.org>
fluent/fluent-bit,fluent/fluent-bit,nokute78/fluent-bit,nokute78/fluent-bit,fluent/fluent-bit,nokute78/fluent-bit,fluent/fluent-bit,nokute78/fluent-bit,fluent/fluent-bit,nokute78/fluent-bit,fluent/fluent-bit,nokute78/fluent-bit,fluent/fluent-bit,fluent/fluent-bit,nokute78/fluent-bit,nokute78/fluent-bit,nokute78/fluent-bit,nokute78/fluent-bit,fluent/fluent-bit,nokute78/fluent-bit,fluent/fluent-bit,fluent/fluent-bit,nokute78/fluent-bit,fluent/fluent-bit