summaryrefslogtreecommitdiffstats
path: root/src/libcephfs.cc
diff options
context:
space:
mode:
authorAnoop C S <anoopcs@cryptolab.net>2024-09-23 09:06:55 +0200
committerAnoop C S <anoopcs@cryptolab.net>2024-11-07 06:09:16 +0100
commitedd7fe76c4919bc243377c6d7aae20b0606b89c3 (patch)
tree1089089afdd266db082456e6a35e14546b0c8114 /src/libcephfs.cc
parentlibcephfs.h: Fix API documentation for ceph_statxat (diff)
downloadceph-edd7fe76c4919bc243377c6d7aae20b0606b89c3.tar.xz
ceph-edd7fe76c4919bc243377c6d7aae20b0606b89c3.zip
client: Gracefully handle empty pathname for statxat()
man statx(2)[1] says the following: . . . AT_EMPTY_PATH If pathname is an empty string, operate on the file referred to by dirfd (which may have been obtained using the open(2) O_PATH flag). In this case, dirfd can refer to any type of file, not just a directory. If dirfd is AT_FDCWD, the call operates on the current working directory. . . . Look out for an empty pathname and use the relative fd's inode in the presence of AT_EMPTY_PATH flag before calling internal _getattr(). Fixes: https://tracker.ceph.com/issues/68189 Review with: git show -w [1] https://www.man7.org/linux/man-pages/man2/statx.2.html Signed-off-by: Anoop C S <anoopcs@cryptolab.net>
Diffstat (limited to 'src/libcephfs.cc')
-rw-r--r--src/libcephfs.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libcephfs.cc b/src/libcephfs.cc
index 7eea6665f61..60da6145787 100644
--- a/src/libcephfs.cc
+++ b/src/libcephfs.cc
@@ -982,7 +982,11 @@ extern "C" int ceph_statxat(struct ceph_mount_info *cmount, int dirfd, const cha
{
if (!cmount->is_mounted())
return -CEPHFS_ENOTCONN;
+#ifdef CEPH_AT_EMPTY_PATH
+ if (flags & ~CEPH_AT_EMPTY_PATH)
+#else
if (flags & ~CEPH_REQ_FLAG_MASK)
+#endif
return -CEPHFS_EINVAL;
return cmount->get_client()->statxat(dirfd, relpath, stx, cmount->default_perms,
want, flags);