statx: Kill fd-with-NULL-path support in favour of AT_EMPTY_PATH

Linux Kernel / Linux Kernel - David Howells [redhat.com] - 26 April 2017 18:05 EDT

With the new statx() syscall, the following both allow the attributes of the file attached to a file descriptor to be retrieved:

statx(dfd, NULL, 0, ...);

and:

statx(dfd, "", AT_EMPTY_PATH, ...);

Change the code to reject the first option, though this means copying the path and engaging pathwalk for the fstat() equivalent. dfd can be a non-directory provided path is "".

[ The timing of this isn't wonderful, but applying this now before we have statx() in any released kernel, before anybody starts using the NULL special case. - Linus ]

Fixes: a528d35e8bfc ("statx: Add a system call to make enhanced file info available")

1e2f82d statx: Kill fd-with-NULL-path support in favour of AT_EMPTY_PATH
fs/stat.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)

Upstream: git.kernel.org


  • Share