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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id CCA3D138350 for ; Fri, 31 Jan 2020 14:45:50 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E82ADE081A; Fri, 31 Jan 2020 14:45:49 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id D10B8E081A for ; Fri, 31 Jan 2020 14:45:49 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B27BF34E625 for ; Fri, 31 Jan 2020 14:45:48 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 579AF7B for ; Fri, 31 Jan 2020 14:45:47 +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: <1580481828.749ad1d7d40276594a2bb69c4d71da33b6abecbd.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: / X-VCS-Repository: proj/portage-utils X-VCS-Files: qsize.c X-VCS-Directories: / X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: 749ad1d7d40276594a2bb69c4d71da33b6abecbd X-VCS-Branch: master Date: Fri, 31 Jan 2020 14:45:47 +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: e2c94c88-15a9-47e7-8245-526403f81848 X-Archives-Hash: a0a5f6c97291082069a6d3a77c381981 commit: 749ad1d7d40276594a2bb69c4d71da33b6abecbd Author: Fabian Groffen gentoo org> AuthorDate: Fri Jan 31 14:43:48 2020 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Fri Jan 31 14:43:48 2020 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=749ad1d7 qsize: solve theoretical key conflict for dev/inode Jan Ziak pointed out that it is possible to generate the same key for two different files. Signed-off-by: Fabian Groffen gentoo.org> qsize.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qsize.c b/qsize.c index e54f714..c78a35f 100644 --- a/qsize.c +++ b/qsize.c @@ -112,7 +112,7 @@ qsize_cb(tree_pkg_ctx *pkg_ctx, void *priv) uint64_t num_bytes; struct stat st; bool ok = false; - char ikey[2 * (sizeof(size_t) * 2) + 1]; /* hex rep */ + char ikey[2 * (sizeof(size_t) * 2) + 1 + 1]; /* hex rep */ size_t cur_uniq = cnt_set(state->uniq_files); bool isuniq; @@ -143,7 +143,7 @@ qsize_cb(tree_pkg_ctx *pkg_ctx, void *priv) if (fstatat(pkg_ctx->cat_ctx->ctx->portroot_fd, e->name + 1, &st, AT_SYMLINK_NOFOLLOW) == 0) { - snprintf(ikey, sizeof(ikey), "%zx%zx", + snprintf(ikey, sizeof(ikey), "%zx:%zx", (size_t)st.st_dev, (size_t)st.st_ino); state->uniq_files = add_set_unique(ikey, state->uniq_files, &isuniq);