]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib/zlog: fix coverity warning
authorDavid Lamparter <equinox@diac24.net>
Mon, 20 Apr 2020 21:17:17 +0000 (23:17 +0200)
committerDavid Lamparter <equinox@diac24.net>
Mon, 20 Apr 2020 21:17:17 +0000 (23:17 +0200)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/zlog.c

index 4cab23699412668af95cc112da9d2a14a09cd551..45726755f8d397a04f3dc819865906aa4a09ad42 100644 (file)
@@ -238,13 +238,12 @@ void zlog_tls_buffer_init(void)
 
        mmfd = openat(zlog_tmpdirfd, mmpath,
                      O_RDWR | O_CREAT | O_EXCL | O_CLOEXEC, 0600);
-       fchown(mmfd, zlog_uid, zlog_gid);
-
        if (mmfd < 0) {
                zlog_err("failed to open thread log buffer \"%s\": %s",
                         mmpath, strerror(errno));
                goto out_anon;
        }
+       fchown(mmfd, zlog_uid, zlog_gid);
 
 #ifdef HAVE_POSIX_FALLOCATE
        if (posix_fallocate(mmfd, 0, TLS_LOG_BUF_SIZE) < 0) {