From 25334078f4fb7d617ba23a705360121749382cd1 Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Tue, 22 Apr 2008 16:21:12 -0700 Subject: Die on early EOF in slurp_file, instead of infinite-looping. Signed-off-by: Jamey Sharp Signed-off-by: Simon Horman --- kexec/kexec.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'kexec/kexec.c') diff --git a/kexec/kexec.c b/kexec/kexec.c index 3a1656a..f898428 100644 --- a/kexec/kexec.c +++ b/kexec/kexec.c @@ -408,6 +408,8 @@ char *slurp_file(const char *filename, off_t *r_size) die("read on %s of %ld bytes failed: %s\n", filename, (size - progress)+ 0UL, strerror(errno)); } + if (result == 0) + die("read on %s ended before stat said it should\n", filename); progress += result; } result = close(fd); -- cgit