diff options
author | Jamey Sharp <jamey@thetovacompany.com> | 2008-04-22 16:21:12 -0700 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2008-04-24 11:23:05 +1000 |
commit | 25334078f4fb7d617ba23a705360121749382cd1 (patch) | |
tree | 339280b7279c98fe1b37925963853df19675aaab /kexec/kexec.c | |
parent | d5123a084bf2ba11e440b7dd238a7413b7e59956 (diff) |
Die on early EOF in slurp_file, instead of infinite-looping.
Signed-off-by: Jamey Sharp <jamey@thetovacompany.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec/kexec.c')
-rw-r--r-- | kexec/kexec.c | 2 |
1 files changed, 2 insertions, 0 deletions
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); |