Commit 7f14daa1 authored by Petr Vandrovec's avatar Petr Vandrovec Committed by Linus Torvalds

[PATCH] Get core dump code to work...

The file based core dump code was broken by pipe changes - a relative
llseek returns the absolute file position on success, not the relative
one, so dump_seek() always failed when invoked with non-zero current
position.

Only success/failure can be tested with relative lseek, we have to trust
kernel that on success we've got right file offset.  With this fix in
place I have finally real core files instead of 1KB fragments...
Signed-off-by: default avatarPetr Vandrovec <petr@vandrovec.name>
[ Cleaned it up a bit while here - use SEEK_CUR instead of hardcoding 1 ]
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 12e36b2f
...@@ -1152,7 +1152,7 @@ static int dump_write(struct file *file, const void *addr, int nr) ...@@ -1152,7 +1152,7 @@ static int dump_write(struct file *file, const void *addr, int nr)
static int dump_seek(struct file *file, loff_t off) static int dump_seek(struct file *file, loff_t off)
{ {
if (file->f_op->llseek && file->f_op->llseek != no_llseek) { if (file->f_op->llseek && file->f_op->llseek != no_llseek) {
if (file->f_op->llseek(file, off, 1) != off) if (file->f_op->llseek(file, off, SEEK_CUR) < 0)
return 0; return 0;
} else { } else {
char *buf = (char *)get_zeroed_page(GFP_KERNEL); char *buf = (char *)get_zeroed_page(GFP_KERNEL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment