Fix crash on config read

PR:		248249
Submitted by:	pi
Reported by:	Raul Munos <raul.munoz@custos.es>, Juraj Lutter <juraj@lutter.sk>
This commit is contained in:
Olivier Cochard 2020-07-24 20:21:32 +00:00
parent a8c8f5164a
commit ff49eb4e23
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=543378
2 changed files with 17 additions and 0 deletions

View File

@ -3,6 +3,7 @@
PORTNAME= frr
PORTVERSION= 7.4
DISTVERSIONPREFIX= frr-
PORTREVISION= 1
CATEGORIES= net
.if defined(PYTHONTOOLS)
PKGNAMESUFFIX= 7-pythontool

View File

@ -0,0 +1,16 @@
--- lib/zlog.c.orig 2020-06-30 11:08:57 UTC
+++ 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;