[prev in list] [next in list] [prev in thread] [next in thread]
List: kexec
Subject: [PATCH] slurpfile: use lseek() on block nodes instead of fstat()
From: Austin Morgan <admorgan () morgancomputers ! net>
Date: 2010-10-28 21:25:27
Message-ID: 20101028212515.GA24848 () alexandria ! lan
[Download RAW message or body]
fstat() is used to determine the file size before read() and
it requires a files ystem. That means that it can not be used
on block nodes. This makes it impossible to obtain the
kernel from a raw block device.
We can't use this in every case because files in /proc doesn't
support lseek().
Signed-off-by: Austin Morgan <admorgan@morgancomputers.net>
---
kexec/kexec.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kexec/kexec.c b/kexec/kexec.c
index 10ad41d..e9d6a54 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -499,7 +499,7 @@ char *slurp_file(const char *filename, off_t *r_size)
* This does not work on regular files which live in /proc and
* we need this for some /proc/device-tree entries
*/
- if (S_ISCHR(stats.st_mode)) {
+ if (S_ISCHR(stats.st_mode) || S_ISBLK(stats.st_mode)) {
size = lseek(fd, 0, SEEK_END);
if (size < 0)
--
1.7.2.2
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic