Merge pull request #6772 from opensourcerouting/7.4/netbsd-tls-buf

[7.4] lib: fix TLS log buffer on NetBSD
This commit is contained in:
Quentin Young 2020-07-24 14:53:35 -04:00 committed by GitHub
commit 78292ed227
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -246,10 +246,10 @@ void zlog_tls_buffer_init(void)
fchown(mmfd, zlog_uid, zlog_gid);
#ifdef HAVE_POSIX_FALLOCATE
if (posix_fallocate(mmfd, 0, TLS_LOG_BUF_SIZE) < 0) {
#else
if (ftruncate(mmfd, TLS_LOG_BUF_SIZE) < 0) {
if (posix_fallocate(mmfd, 0, TLS_LOG_BUF_SIZE) != 0)
/* note next statement is under above if() */
#endif
if (ftruncate(mmfd, TLS_LOG_BUF_SIZE) < 0) {
zlog_err("failed to allocate thread log buffer \"%s\": %s",
mmpath, strerror(errno));
goto out_anon_unlink;