summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2020-07-19 11:14:48 +0200
committerDavid Lamparter <equinox@diac24.net>2020-07-20 06:29:06 +0200
commit6a3b431b85088d2d76a14d6c22ee85bdc5465c8c (patch)
treedf30889b8ffbf983970a86887d6674da58c5343b
parentMerge pull request #6767 from donaldsharp/compile_issues (diff)
downloadfrr-6a3b431b85088d2d76a14d6c22ee85bdc5465c8c.tar.xz
frr-6a3b431b85088d2d76a14d6c22ee85bdc5465c8c.zip
lib: fix TLS log buffer on NetBSD
... this didn't work on NetBSD. Like, at all. It returns a positive error code from posix_fallocate() and then we bang our head against a brick wall trying to write to the mmap'd buffer. Signed-off-by: David Lamparter <equinox@diac24.net>
-rw-r--r--lib/zlog.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/zlog.c b/lib/zlog.c
index 45726755f..8dfd20371 100644
--- a/lib/zlog.c
+++ b/lib/zlog.c
@@ -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;