Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 105969
b: refs/heads/master
c: f1a43f9
h: refs/heads/master
i:
  105967: d6c4c15
v: v3
  • Loading branch information
Akinobu Mita authored and Linus Torvalds committed Jul 25, 2008
1 parent dc9dc08 commit ac800cd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 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: 380af1b33b3ff92df5cda96329b58f5d1b6b5a53
refs/heads/master: f1a43f93f0f3bab418800eaccb9e2e3b5427e173
25 changes: 7 additions & 18 deletions trunk/ipc/mqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,15 +314,11 @@ static int mqueue_unlink(struct inode *dir, struct dentry *dentry)
* through std routines)
*/
static ssize_t mqueue_read_file(struct file *filp, char __user *u_data,
size_t count, loff_t * off)
size_t count, loff_t *off)
{
struct mqueue_inode_info *info = MQUEUE_I(filp->f_path.dentry->d_inode);
char buffer[FILENT_SIZE];
size_t slen;
loff_t o;

if (!count)
return 0;
ssize_t ret;

spin_lock(&info->lock);
snprintf(buffer, sizeof(buffer),
Expand All @@ -335,21 +331,14 @@ static ssize_t mqueue_read_file(struct file *filp, char __user *u_data,
pid_vnr(info->notify_owner));
spin_unlock(&info->lock);
buffer[sizeof(buffer)-1] = '\0';
slen = strlen(buffer)+1;

o = *off;
if (o > slen)
return 0;

if (o + count > slen)
count = slen - o;

if (copy_to_user(u_data, buffer + o, count))
return -EFAULT;
ret = simple_read_from_buffer(u_data, count, off, buffer,
strlen(buffer));
if (ret <= 0)
return ret;

*off = o + count;
filp->f_path.dentry->d_inode->i_atime = filp->f_path.dentry->d_inode->i_ctime = CURRENT_TIME;
return count;
return ret;
}

static int mqueue_flush_file(struct file *filp, fl_owner_t id)
Expand Down

0 comments on commit ac800cd

Please sign in to comment.