From d39b85ae3240b5c94f570f51918df7260e4366e0 Mon Sep 17 00:00:00 2001
From: Evgeny Sinelnikov <sin@altlinux.org>
Date: Thu, 29 Aug 2019 23:46:14 +0400
Subject: [PATCH] tools.c: break reading cycle if we actually loaded program
 into memory

---
 tools.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools.c b/tools.c
index f30d554..c8e7f7b 100644
--- a/tools.c
+++ b/tools.c
@@ -320,6 +320,8 @@ enum return_type load_ramdisk_fd(int source_fd, unsigned long size)
 			return RETURN_ERROR;
 		}
 		update_progression((int)(bytes_read += actually));
+		if (bytes_read == size)
+			break;
 	}
 
 	if (!seems_ok) {