]> Git Repo - linux.git/commitdiff
vfs: make O_PATH file descriptors usable for 'fstat()'
authorLinus Torvalds <[email protected]>
Fri, 14 Sep 2012 21:48:21 +0000 (14:48 -0700)
committerLinus Torvalds <[email protected]>
Fri, 14 Sep 2012 21:48:21 +0000 (14:48 -0700)
We already use them for openat() and friends, but fstat() also wants to
be able to use O_PATH file descriptors.  This should make it more
directly comparable to the O_SEARCH of Solaris.

Note that you could already do the same thing with "fstatat()" and an
empty path, but just doing "fstat()" directly is simpler and faster, so
there is no reason not to just allow it directly.

See also commit 332a2e1244bd, which did the same thing for fchdir, for
the same reasons.

Reported-by: ольга крыжановская <[email protected]>
Cc: Al Viro <[email protected]>
Cc: [email protected] # O_PATH introduced in 3.0+
Signed-off-by: Linus Torvalds <[email protected]>
fs/stat.c

index b6ff11825fc8a9c37f8d45ccf01e1fbdc1115868..40780229a03281376d4d449e896745f3f169a0d3 100644 (file)
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -58,7 +58,7 @@ EXPORT_SYMBOL(vfs_getattr);
 int vfs_fstat(unsigned int fd, struct kstat *stat)
 {
        int fput_needed;
-       struct file *f = fget_light(fd, &fput_needed);
+       struct file *f = fget_raw_light(fd, &fput_needed);
        int error = -EBADF;
 
        if (f) {
This page took 0.056017 seconds and 4 git commands to generate.