commit: 4b8b0aa52cac041938a08a310f40b6de16b8c3b0 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> AuthorDate: Sat Feb 12 17:12:02 2022 +0000 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> 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 <grobian <AT> 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 - <[email protected]> @@ -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);
