slurpfile: use lseek() on block nodes instead of fstat() for file size
Subsystems (2)
PATCH 1/1 slurpfile: use lseek() on block nodes instead of fstat() for file size
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 <[email protected]>
--- kexec/kexec.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
kexec/kexec.c +1 -1
@@ -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 )
Signature · 7 lines
1.7.2.2 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec