Merge pull request #6771 from opensourcerouting/netbsd-tls-buf

lib: fix TLS log buffer on NetBSD
This commit is contained in:
Quentin Young 2020-07-24 14:53:28 -04:00 committed by GitHub
commit 6df9625212
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;