diff mbox series

[v2,1/2] scripts: mkhash fix return code handling

Message ID 20200717081932.3745194-1-mail@aparcar.org
State Superseded
Headers show
Series [v2,1/2] scripts: mkhash fix return code handling | expand

Commit Message

Paul Spooren July 17, 2020, 8:19 a.m. UTC
If hashing a file fails mkhash shouldn't just silently fail. Now check
after each call of `hash_file()` the return and exit early in case of
errors. The return value which was previously ignored and would always
return 0.

Signed-off-by: Paul Spooren <mail@aparcar.org>
---
 scripts/mkhash.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/scripts/mkhash.c b/scripts/mkhash.c
index e26ca3a350..ea3bd60ce1 100644
--- a/scripts/mkhash.c
+++ b/scripts/mkhash.c
@@ -823,8 +823,11 @@  int main(int argc, char **argv)
 	if (argc < 2)
 		return hash_file(t, NULL, add_filename);
 
-	for (i = 0; i < argc - 1; i++)
-		hash_file(t, argv[1 + i], add_filename);
+	for (i = 0; i < argc - 1; i++) {
+		int ret =  hash_file(t, argv[1 + i], add_filename);
+		if (ret)
+			return ret;
+	}
 
 	return 0;
 }