Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 139749
b: refs/heads/master
c: 6949a63
h: refs/heads/master
i:
  139747: b027741
v: v3
  • Loading branch information
Gerd Hoffmann authored and Linus Torvalds committed Apr 3, 2009
1 parent c14b65e commit d8c9063
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dac1213842f5caf081804a11d87d2a39a21d6f55
refs/heads/master: 6949a6318e60aeb9c755679ac7f978aefe8c1722
25 changes: 18 additions & 7 deletions trunk/fs/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1232,28 +1232,39 @@ compat_sys_readv(unsigned long fd, const struct compat_iovec __user *vec,
return ret;
}

asmlinkage ssize_t
compat_sys_writev(unsigned long fd, const struct compat_iovec __user *vec, unsigned long vlen)
static size_t compat_writev(struct file *file,
const struct compat_iovec __user *vec,
unsigned long vlen, loff_t *pos)
{
struct file *file;
ssize_t ret = -EBADF;

file = fget(fd);
if (!file)
return -EBADF;
if (!(file->f_mode & FMODE_WRITE))
goto out;

ret = -EINVAL;
if (!file->f_op || (!file->f_op->aio_write && !file->f_op->write))
goto out;

ret = compat_do_readv_writev(WRITE, file, vec, vlen, &file->f_pos);
ret = compat_do_readv_writev(WRITE, file, vec, vlen, pos);

out:
if (ret > 0)
add_wchar(current, ret);
inc_syscw(current);
return ret;
}

asmlinkage ssize_t
compat_sys_writev(unsigned long fd, const struct compat_iovec __user *vec,
unsigned long vlen)
{
struct file *file;
ssize_t ret;

file = fget(fd);
if (!file)
return -EBADF;
ret = compat_writev(file, vec, vlen, &file->f_pos);
fput(file);
return ret;
}
Expand Down

0 comments on commit d8c9063

Please sign in to comment.