1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 21:20:33 +02:00

daemon: Avoid comparison of integers of different signs.

Fixes guix/guix#1173.

* nix/libstore/gc.cc (LocalStore::removeUnusedLinks): Cast ‘st_size’ as
unsigned.

Reported-by: Congcong Kuo <congcong.kuo@gmail.com>
Change-Id: Ibe4674bcef186befe8a0e536278c87458b098c9d
This commit is contained in:
Ludovic Courtès
2025-09-06 21:49:31 +02:00
parent b8f528e733
commit 1970abfeb9

View File

@@ -608,7 +608,8 @@ void LocalStore::removeUnusedLinks(const GCState & state)
/* Drop links for files smaller than 'deduplicationMinSize', even if /* Drop links for files smaller than 'deduplicationMinSize', even if
they have more than one hard link. */ they have more than one hard link. */
if (st.st_nlink != 1 && st.st_size >= deduplicationMinSize) { if (st.st_nlink != 1
&& ((unsigned long long) st.st_size) >= deduplicationMinSize) {
actualSize += st.st_size; actualSize += st.st_size;
unsharedSize += (st.st_nlink - 1) * st.st_size; unsharedSize += (st.st_nlink - 1) * st.st_size;
continue; continue;