int do_sys_truncate(const char __user *pathname, loff_t length)
{
unsigned int lookup_flags = LOOKUP_FOLLOW;
- struct filename *name;
struct path path;
int error;
if (length < 0) /* sorry, but loff_t says... */
return -EINVAL;
- name = getname(pathname);
+ CLASS(filename, name)(pathname);
retry:
error = filename_lookup(AT_FDCWD, name, lookup_flags, &path, NULL);
if (!error) {
error = vfs_truncate(&path, length);
path_put(&path);
+ if (retry_estale(error, lookup_flags)) {
+ lookup_flags |= LOOKUP_REVAL;
+ goto retry;
+ }
}
- if (retry_estale(error, lookup_flags)) {
- lookup_flags |= LOOKUP_REVAL;
- goto retry;
- }
- putname(name);
return error;
}