From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 1519715808C for ; Sat, 12 Feb 2022 17:13:26 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 58CADE07F1; Sat, 12 Feb 2022 17:13:25 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 3D33BE07F1 for ; Sat, 12 Feb 2022 17:13:25 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 8C301342F57 for ; Sat, 12 Feb 2022 17:13:23 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 7E8C52D8 for ; Sat, 12 Feb 2022 17:13:20 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1644685922.4b8b0aa52cac041938a08a310f40b6de16b8c3b0.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: libq/ X-VCS-Repository: proj/portage-utils X-VCS-Files: libq/move_file.c X-VCS-Directories: libq/ X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: 4b8b0aa52cac041938a08a310f40b6de16b8c3b0 X-VCS-Branch: master Date: Sat, 12 Feb 2022 17:13:20 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 72047046-f593-422b-9330-76d0bf09ccc5 X-Archives-Hash: 785ee64e3d703a74e9db37576f75caee commit: 4b8b0aa52cac041938a08a310f40b6de16b8c3b0 Author: Fabian Groffen gentoo org> AuthorDate: Sat Feb 12 17:12:02 2022 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Sat Feb 12 17:12:02 2022 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=4b8b0aa5 libq/move_file: fix Coverity uninitialised use CID 248870 Coverity correctly deduced here, that if we used cached stat, we didn't use the cache, but a bogus memory struct instead. Ensure we always use a populated stat value. Signed-off-by: Fabian Groffen gentoo.org> libq/move_file.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libq/move_file.c b/libq/move_file.c index b98c8e2..104ca25 100644 --- a/libq/move_file.c +++ b/libq/move_file.c @@ -1,5 +1,5 @@ /* - * Copyright 2005-2021 Gentoo Authors + * Copyright 2005-2022 Gentoo Authors * Distributed under the terms of the GNU General Public License v2 * * Copyright 2005-2010 Ned Ludd - @@ -86,8 +86,8 @@ move_file(int rootfd_src, const char *name_src, } /* preserve the file times */ - times[0] = get_stat_atime(&st); - times[1] = get_stat_mtime(&st); + times[0] = get_stat_atime(stat_src); + times[1] = get_stat_mtime(stat_src); futimens(fd_dst, times); close(fd_src);