util-linux/backport-mcookie-fix-infinite-loop-when-use-f.patch

27 lines
732 B
Diff
Raw Normal View History

2022-06-20 17:29:05 +08:00
From d380bf23fd68ebc2799eabcd86fb43de797b93d8 Mon Sep 17 00:00:00 2001
From: Hiroaki Sengoku <sengoku@senri.gcd.org>
Date: Fri, 15 Oct 2021 14:02:46 +0900
Subject: [PATCH] mcookie: fix infinite-loop when use -f
Signed-off-by: Karel Zak <kzak@redhat.com>
---
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