diff options
Diffstat (limited to 'fs/compat.c')
-rw-r--r-- | fs/compat.c | 48 |
1 files changed, 42 insertions, 6 deletions
diff --git a/fs/compat.c b/fs/compat.c index 2468ac1df2f0..c6ba9deabada 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -68,10 +68,10 @@ asmlinkage long compat_sys_utime(char __user *filename, struct compat_utimbuf __ | |||
68 | tv[0].tv_usec = 0; | 68 | tv[0].tv_usec = 0; |
69 | tv[1].tv_usec = 0; | 69 | tv[1].tv_usec = 0; |
70 | } | 70 | } |
71 | return do_utimes(filename, t ? tv : NULL); | 71 | return do_utimes(AT_FDCWD, filename, t ? tv : NULL); |
72 | } | 72 | } |
73 | 73 | ||
74 | asmlinkage long compat_sys_utimes(char __user *filename, struct compat_timeval __user *t) | 74 | asmlinkage long compat_sys_futimesat(int dfd, char __user *filename, struct compat_timeval __user *t) |
75 | { | 75 | { |
76 | struct timeval tv[2]; | 76 | struct timeval tv[2]; |
77 | 77 | ||
@@ -82,14 +82,19 @@ asmlinkage long compat_sys_utimes(char __user *filename, struct compat_timeval _ | |||
82 | get_user(tv[1].tv_usec, &t[1].tv_usec)) | 82 | get_user(tv[1].tv_usec, &t[1].tv_usec)) |
83 | return -EFAULT; | 83 | return -EFAULT; |
84 | } | 84 | } |
85 | return do_utimes(filename, t ? tv : NULL); | 85 | return do_utimes(dfd, filename, t ? tv : NULL); |
86 | } | ||
87 | |||
88 | asmlinkage long compat_sys_utimes(char __user *filename, struct compat_timeval __user *t) | ||
89 | { | ||
90 | return compat_sys_futimesat(AT_FDCWD, filename, t); | ||
86 | } | 91 | } |
87 | 92 | ||
88 | asmlinkage long compat_sys_newstat(char __user * filename, | 93 | asmlinkage long compat_sys_newstat(char __user * filename, |
89 | struct compat_stat __user *statbuf) | 94 | struct compat_stat __user *statbuf) |
90 | { | 95 | { |
91 | struct kstat stat; | 96 | struct kstat stat; |
92 | int error = vfs_stat(filename, &stat); | 97 | int error = vfs_stat_fd(AT_FDCWD, filename, &stat); |
93 | 98 | ||
94 | if (!error) | 99 | if (!error) |
95 | error = cp_compat_stat(&stat, statbuf); | 100 | error = cp_compat_stat(&stat, statbuf); |
@@ -100,13 +105,34 @@ asmlinkage long compat_sys_newlstat(char __user * filename, | |||
100 | struct compat_stat __user *statbuf) | 105 | struct compat_stat __user *statbuf) |
101 | { | 106 | { |
102 | struct kstat stat; | 107 | struct kstat stat; |
103 | int error = vfs_lstat(filename, &stat); | 108 | int error = vfs_lstat_fd(AT_FDCWD, filename, &stat); |
104 | 109 | ||
105 | if (!error) | 110 | if (!error) |
106 | error = cp_compat_stat(&stat, statbuf); | 111 | error = cp_compat_stat(&stat, statbuf); |
107 | return error; | 112 | return error; |
108 | } | 113 | } |
109 | 114 | ||
115 | asmlinkage long compat_sys_newfstatat(int dfd, char __user *filename, | ||
116 | struct compat_stat __user *statbuf, int flag) | ||
117 | { | ||
118 | struct kstat stat; | ||
119 | int error = -EINVAL; | ||
120 | |||
121 | if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0) | ||
122 | goto out; | ||
123 | |||
124 | if (flag & AT_SYMLINK_NOFOLLOW) | ||
125 | error = vfs_lstat_fd(dfd, filename, &stat); | ||
126 | else | ||
127 | error = vfs_stat_fd(dfd, filename, &stat); | ||
128 | |||
129 | if (!error) | ||
130 | error = cp_compat_stat(&stat, statbuf); | ||
131 | |||
132 | out: | ||
133 | return error; | ||
134 | } | ||
135 | |||
110 | asmlinkage long compat_sys_newfstat(unsigned int fd, | 136 | asmlinkage long compat_sys_newfstat(unsigned int fd, |
111 | struct compat_stat __user * statbuf) | 137 | struct compat_stat __user * statbuf) |
112 | { | 138 | { |
@@ -1290,7 +1316,17 @@ out: | |||
1290 | asmlinkage long | 1316 | asmlinkage long |
1291 | compat_sys_open(const char __user *filename, int flags, int mode) | 1317 | compat_sys_open(const char __user *filename, int flags, int mode) |
1292 | { | 1318 | { |
1293 | return do_sys_open(filename, flags, mode); | 1319 | return do_sys_open(AT_FDCWD, filename, flags, mode); |
1320 | } | ||
1321 | |||
1322 | /* | ||
1323 | * Exactly like fs/open.c:sys_openat(), except that it doesn't set the | ||
1324 | * O_LARGEFILE flag. | ||
1325 | */ | ||
1326 | asmlinkage long | ||
1327 | compat_sys_openat(int dfd, const char __user *filename, int flags, int mode) | ||
1328 | { | ||
1329 | return do_sys_open(dfd, filename, flags, mode); | ||
1294 | } | 1330 | } |
1295 | 1331 | ||
1296 | /* | 1332 | /* |