From d380bf23fd68ebc2799eabcd86fb43de797b93d8 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 3157401..be5c34a 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; -- 1.8.3.1