Skip to content
Snippets Groups Projects
Commit 64308484 authored by Sergey Bronnikov's avatar Sergey Bronnikov Committed by Kirill Yukhin
Browse files

say: fix compilation on OpenBSD

- define macros LOG_MAKEPRI() on OpenBSD as it is absent
- replace sigtimedwait() by sigwait() as latter is unsupported on OpenBSD

Part of #4967
parent fd653200
No related branches found
No related tags found
No related merge requests found
......@@ -434,10 +434,19 @@ log_pipe_init(struct log *log, const char *init_str)
struct timespec timeout;
timeout.tv_sec = 0;
timeout.tv_nsec = 1; /* Mostly to trigger preemption. */
#if defined(__OpenBSD__)
int sig = 0;
sigwait(&mask, &sig);
if (sig ==SIGCHLD) {
diag_set(IllegalParams, "logger process died");
return -1;
}
#else
if (sigtimedwait(&mask, NULL, &timeout) == SIGCHLD) {
diag_set(IllegalParams, "logger process died");
return -1;
}
#endif
#endif
/* OK, let's hope for the best. */
sigprocmask(SIG_UNBLOCK, &mask, NULL);
......@@ -945,6 +954,9 @@ say_format_syslog(struct log *log, char *buf, int len, int level, const char *fi
/* Format syslog header according to RFC */
int prio = level_to_syslog_priority(level);
#if defined(__OpenBSD__)
#define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri))
#endif
SNPRINT(total, snprintf, buf, len, "<%d>",
LOG_MAKEPRI(8 * log->syslog_facility, prio));
SNPRINT(total, strftime, buf, len, "%h %e %T ", &tm);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment