Commit 44a3b874 authored by Miklos Szeredi's avatar Miklos Szeredi

utimensat: AT_EMPTY_PATH support

This makes it possible to use utimensat on an O_PATH file (including
symlinks).

It supersedes the nonstandard utimensat(fd, NULL, ...) form.

Cc: linux-api@vger.kernel.org
Cc: linux-man@vger.kernel.org
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent 94704515
...@@ -95,13 +95,13 @@ long do_utimes(int dfd, const char __user *filename, struct timespec64 *times, ...@@ -95,13 +95,13 @@ long do_utimes(int dfd, const char __user *filename, struct timespec64 *times,
goto out; goto out;
} }
if (flags & ~AT_SYMLINK_NOFOLLOW) if (flags & ~(AT_SYMLINK_NOFOLLOW | AT_EMPTY_PATH))
goto out; goto out;
if (filename == NULL && dfd != AT_FDCWD) { if (filename == NULL && dfd != AT_FDCWD) {
struct fd f; struct fd f;
if (flags & AT_SYMLINK_NOFOLLOW) if (flags)
goto out; goto out;
f = fdget(dfd); f = fdget(dfd);
...@@ -117,6 +117,8 @@ long do_utimes(int dfd, const char __user *filename, struct timespec64 *times, ...@@ -117,6 +117,8 @@ long do_utimes(int dfd, const char __user *filename, struct timespec64 *times,
if (!(flags & AT_SYMLINK_NOFOLLOW)) if (!(flags & AT_SYMLINK_NOFOLLOW))
lookup_flags |= LOOKUP_FOLLOW; lookup_flags |= LOOKUP_FOLLOW;
if (flags & AT_EMPTY_PATH)
lookup_flags |= LOOKUP_EMPTY;
retry: retry:
error = user_path_at(dfd, filename, lookup_flags, &path); error = user_path_at(dfd, filename, lookup_flags, &path);
if (error) if (error)
......
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