Commit 22782ffc authored by Linus Torvalds's avatar Linus Torvalds

Teach sendfile() to honour non-seekable source files.

Remove the test from the socket code, now that it's no
longer necessary.
parent ae61518f
...@@ -567,8 +567,12 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos, ...@@ -567,8 +567,12 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
goto fput_in; goto fput_in;
if (!in_file->f_op || !in_file->f_op->sendfile) if (!in_file->f_op || !in_file->f_op->sendfile)
goto fput_in; goto fput_in;
retval = -ESPIPE;
if (!ppos) if (!ppos)
ppos = &in_file->f_pos; ppos = &in_file->f_pos;
else
if (!(in_file->f_mode & FMODE_PREAD))
goto fput_in;
retval = locks_verify_area(FLOCK_VERIFY_READ, in_inode, in_file, *ppos, count); retval = locks_verify_area(FLOCK_VERIFY_READ, in_inode, in_file, *ppos, count);
if (retval) if (retval)
goto fput_in; goto fput_in;
......
...@@ -727,9 +727,6 @@ ssize_t sock_sendpage(struct file *file, struct page *page, ...@@ -727,9 +727,6 @@ ssize_t sock_sendpage(struct file *file, struct page *page,
struct socket *sock; struct socket *sock;
int flags; int flags;
if (ppos != &file->f_pos)
return -ESPIPE;
sock = SOCKET_I(file->f_dentry->d_inode); sock = SOCKET_I(file->f_dentry->d_inode);
flags = !(file->f_flags & O_NONBLOCK) ? 0 : MSG_DONTWAIT; flags = !(file->f_flags & O_NONBLOCK) ? 0 : MSG_DONTWAIT;
......
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