From 60e5bb73990260836b087735a9c69deab8af4c81 Mon Sep 17 00:00:00 2001 From: Hiroaki Sengoku Date: Fri, 15 Oct 2021 14:02:46 +0900 Subject: [PATCH] mcookie: fix infinite-loop when use -f Signed-off-by: Karel Zak --- misc-utils/mcookie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc-utils/mcookie.c b/misc-utils/mcookie.c index 315740127e..be5c34ae4c 100644 --- a/misc-utils/mcookie.c +++ b/misc-utils/mcookie.c @@ -65,7 +65,7 @@ static uint64_t hash_file(struct mcookie_control *ctl, int fd) rdsz = wanted - count; r = read_all(fd, (char *) buf, rdsz); - if (r < 0) + if (r <= 0) break; ul_MD5Update(&ctl->ctx, buf, r); count += r; -- 2.47.2