Commit 55e4def0 authored by David Howells's avatar David Howells Committed by Al Viro

VFS: Make chown() and lchown() call fchownat()

Make the chown() and lchown() syscalls jump to the fchownat() syscall with the
appropriate extra arguments.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent c3c4f694
...@@ -537,25 +537,6 @@ static int chown_common(struct path *path, uid_t user, gid_t group) ...@@ -537,25 +537,6 @@ static int chown_common(struct path *path, uid_t user, gid_t group)
return error; return error;
} }
SYSCALL_DEFINE3(chown, const char __user *, filename, uid_t, user, gid_t, group)
{
struct path path;
int error;
error = user_path(filename, &path);
if (error)
goto out;
error = mnt_want_write(path.mnt);
if (error)
goto out_release;
error = chown_common(&path, user, group);
mnt_drop_write(path.mnt);
out_release:
path_put(&path);
out:
return error;
}
SYSCALL_DEFINE5(fchownat, int, dfd, const char __user *, filename, uid_t, user, SYSCALL_DEFINE5(fchownat, int, dfd, const char __user *, filename, uid_t, user,
gid_t, group, int, flag) gid_t, group, int, flag)
{ {
...@@ -583,23 +564,15 @@ SYSCALL_DEFINE5(fchownat, int, dfd, const char __user *, filename, uid_t, user, ...@@ -583,23 +564,15 @@ SYSCALL_DEFINE5(fchownat, int, dfd, const char __user *, filename, uid_t, user,
return error; return error;
} }
SYSCALL_DEFINE3(lchown, const char __user *, filename, uid_t, user, gid_t, group) SYSCALL_DEFINE3(chown, const char __user *, filename, uid_t, user, gid_t, group)
{ {
struct path path; return sys_fchownat(AT_FDCWD, filename, user, group, 0);
int error; }
error = user_lpath(filename, &path); SYSCALL_DEFINE3(lchown, const char __user *, filename, uid_t, user, gid_t, group)
if (error) {
goto out; return sys_fchownat(AT_FDCWD, filename, user, group,
error = mnt_want_write(path.mnt); AT_SYMLINK_NOFOLLOW);
if (error)
goto out_release;
error = chown_common(&path, user, group);
mnt_drop_write(path.mnt);
out_release:
path_put(&path);
out:
return error;
} }
SYSCALL_DEFINE3(fchown, unsigned int, fd, uid_t, user, gid_t, group) SYSCALL_DEFINE3(fchown, unsigned int, fd, uid_t, user, gid_t, group)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment