diff options
Diffstat (limited to 'fs/ext2/symlink.c')
-rw-r--r-- | fs/ext2/symlink.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/ext2/symlink.c b/fs/ext2/symlink.c index 461e038c2..31f8276b0 100644 --- a/fs/ext2/symlink.c +++ b/fs/ext2/symlink.c @@ -87,7 +87,7 @@ static int ext2_follow_link(struct inode * dir, struct inode * inode, link = bh->b_data; } else link = (char *) inode->u.ext2_i.i_data; - if (!IS_RDONLY(inode)) { + if (DO_UPDATE_ATIME(inode)) { inode->i_atime = CURRENT_TIME; inode->i_dirt = 1; } @@ -105,7 +105,6 @@ static int ext2_readlink (struct inode * inode, char * buffer, int buflen) struct buffer_head * bh = NULL; char * link; int i, err; - char c; if (!S_ISLNK(inode->i_mode)) { iput (inode); @@ -123,12 +122,13 @@ static int ext2_readlink (struct inode * inode, char * buffer, int buflen) } else link = (char *) inode->u.ext2_i.i_data; + i = 0; - while (i < buflen && (c = link[i])) { + while (i < buflen && link[i]) i++; - put_user (c, buffer++); - } - if (!IS_RDONLY(inode)) { + if (copy_to_user(buffer, link, i)) + i = -EFAULT; + if (DO_UPDATE_ATIME(inode)) { inode->i_atime = CURRENT_TIME; inode->i_dirt = 1; } |