aboutsummaryrefslogtreecommitdiffstats
path: root/fs/open.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-02-24 13:49:08 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2013-02-25 09:24:55 -0500
commit3f6d078d4accfff8b114f968259a060bfdc7c682 (patch)
tree8de5ba3fc3ea069e5f5fe43e8d0796ff4ef9bcaa /fs/open.c
parent561c6731978fa128f29342495f47fc3365898b3d (diff)
fix compat truncate/ftruncate
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/open.c b/fs/open.c
index 9b33c0cbfacf..669ba0dd6667 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -30,6 +30,7 @@
30#include <linux/fs_struct.h> 30#include <linux/fs_struct.h>
31#include <linux/ima.h> 31#include <linux/ima.h>
32#include <linux/dnotify.h> 32#include <linux/dnotify.h>
33#include <linux/compat.h>
33 34
34#include "internal.h" 35#include "internal.h"
35 36
@@ -140,6 +141,13 @@ SYSCALL_DEFINE2(truncate, const char __user *, path, long, length)
140 return do_sys_truncate(path, length); 141 return do_sys_truncate(path, length);
141} 142}
142 143
144#ifdef CONFIG_COMPAT
145COMPAT_SYSCALL_DEFINE2(truncate, const char __user *, path, compat_off_t, length)
146{
147 return do_sys_truncate(path, length);
148}
149#endif
150
143static long do_sys_ftruncate(unsigned int fd, loff_t length, int small) 151static long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
144{ 152{
145 struct inode *inode; 153 struct inode *inode;
@@ -195,6 +203,13 @@ SYSCALL_DEFINE2(ftruncate, unsigned int, fd, unsigned long, length)
195 return ret; 203 return ret;
196} 204}
197 205
206#ifdef CONFIG_COMPAT
207COMPAT_SYSCALL_DEFINE2(ftruncate, unsigned int, fd, compat_ulong_t, length)
208{
209 return do_sys_ftruncate(fd, length, 1);
210}
211#endif
212
198/* LFS versions of truncate are only needed on 32 bit machines */ 213/* LFS versions of truncate are only needed on 32 bit machines */
199#if BITS_PER_LONG == 32 214#if BITS_PER_LONG == 32
200SYSCALL_DEFINE(truncate64)(const char __user * path, loff_t length) 215SYSCALL_DEFINE(truncate64)(const char __user * path, loff_t length)