utimes.c (3a20ac2c52b1317f5a5f0bd9cd3cbe8495ddd026) | utimes.c (c7887325230aec47d47a32562a6e26014a0fafca) |
---|---|
1#include <linux/compiler.h> 2#include <linux/file.h> 3#include <linux/fs.h> 4#include <linux/linkage.h> 5#include <linux/mount.h> 6#include <linux/namei.h> 7#include <linux/sched.h> 8#include <linux/stat.h> --- 112 unchanged lines hidden (view full) --- 121 * If filename is NULL and dfd refers to an open file, then operate on 122 * the file. Otherwise look up filename, possibly using dfd as a 123 * starting point. 124 * 125 * If times==NULL, set access and modification to current time, 126 * must be owner or have write permission. 127 * Else, update from *times, must be owner or super user. 128 */ | 1#include <linux/compiler.h> 2#include <linux/file.h> 3#include <linux/fs.h> 4#include <linux/linkage.h> 5#include <linux/mount.h> 6#include <linux/namei.h> 7#include <linux/sched.h> 8#include <linux/stat.h> --- 112 unchanged lines hidden (view full) --- 121 * If filename is NULL and dfd refers to an open file, then operate on 122 * the file. Otherwise look up filename, possibly using dfd as a 123 * starting point. 124 * 125 * If times==NULL, set access and modification to current time, 126 * must be owner or have write permission. 127 * Else, update from *times, must be owner or super user. 128 */ |
129long do_utimes(int dfd, char __user *filename, struct timespec *times, int flags) | 129long do_utimes(int dfd, const char __user *filename, struct timespec *times, 130 int flags) |
130{ 131 int error = -EINVAL; 132 133 if (times && (!nsec_valid(times[0].tv_nsec) || 134 !nsec_valid(times[1].tv_nsec))) { 135 goto out; 136 } 137 --- 27 unchanged lines hidden (view full) --- 165 error = utimes_common(&path, times); 166 path_put(&path); 167 } 168 169out: 170 return error; 171} 172 | 131{ 132 int error = -EINVAL; 133 134 if (times && (!nsec_valid(times[0].tv_nsec) || 135 !nsec_valid(times[1].tv_nsec))) { 136 goto out; 137 } 138 --- 27 unchanged lines hidden (view full) --- 166 error = utimes_common(&path, times); 167 path_put(&path); 168 } 169 170out: 171 return error; 172} 173 |
173SYSCALL_DEFINE4(utimensat, int, dfd, char __user *, filename, | 174SYSCALL_DEFINE4(utimensat, int, dfd, const char __user *, filename, |
174 struct timespec __user *, utimes, int, flags) 175{ 176 struct timespec tstimes[2]; 177 178 if (utimes) { 179 if (copy_from_user(&tstimes, utimes, sizeof(tstimes))) 180 return -EFAULT; 181 182 /* Nothing to do, we must not even check the path. */ 183 if (tstimes[0].tv_nsec == UTIME_OMIT && 184 tstimes[1].tv_nsec == UTIME_OMIT) 185 return 0; 186 } 187 188 return do_utimes(dfd, filename, utimes ? tstimes : NULL, flags); 189} 190 | 175 struct timespec __user *, utimes, int, flags) 176{ 177 struct timespec tstimes[2]; 178 179 if (utimes) { 180 if (copy_from_user(&tstimes, utimes, sizeof(tstimes))) 181 return -EFAULT; 182 183 /* Nothing to do, we must not even check the path. */ 184 if (tstimes[0].tv_nsec == UTIME_OMIT && 185 tstimes[1].tv_nsec == UTIME_OMIT) 186 return 0; 187 } 188 189 return do_utimes(dfd, filename, utimes ? tstimes : NULL, flags); 190} 191 |
191SYSCALL_DEFINE3(futimesat, int, dfd, char __user *, filename, | 192SYSCALL_DEFINE3(futimesat, int, dfd, const char __user *, filename, |
192 struct timeval __user *, utimes) 193{ 194 struct timeval times[2]; 195 struct timespec tstimes[2]; 196 197 if (utimes) { 198 if (copy_from_user(×, utimes, sizeof(times))) 199 return -EFAULT; --- 24 unchanged lines hidden --- | 193 struct timeval __user *, utimes) 194{ 195 struct timeval times[2]; 196 struct timespec tstimes[2]; 197 198 if (utimes) { 199 if (copy_from_user(×, utimes, sizeof(times))) 200 return -EFAULT; --- 24 unchanged lines hidden --- |