mountpoint-util: statx() may return EINVAL if the kernel does not support the syscall
When statx() is called with AT_STATX_DONT_SYNC, glibc's fallback code returns EINVAL. See statx_generic() in glibc.
This commit is contained in:
@@ -223,7 +223,9 @@ int fd_is_mount_point(int fd, const char *filename, int flags) {
|
||||
AT_STATX_DONT_SYNC, /* don't go to the network for this – for similar reasons */
|
||||
STATX_TYPE,
|
||||
&sx) < 0) {
|
||||
if (!ERRNO_IS_NOT_SUPPORTED(errno) && !ERRNO_IS_PRIVILEGE(errno))
|
||||
if (!ERRNO_IS_NOT_SUPPORTED(errno) && /* statx() is not supported by the kernel. */
|
||||
!ERRNO_IS_PRIVILEGE(errno) && /* maybe filtered by seccomp. */
|
||||
errno != EINVAL) /* glibc's fallback method returns EINVAL when AT_STATX_DONT_SYNC is set. */
|
||||
return -errno;
|
||||
|
||||
/* If statx() is not available or forbidden, fall back to name_to_handle_at() below */
|
||||
@@ -371,7 +373,9 @@ int path_get_mnt_id_at(int dir_fd, const char *path, int *ret) {
|
||||
AT_STATX_DONT_SYNC, /* don't go to the network, mnt_id is a local concept */
|
||||
STATX_MNT_ID,
|
||||
&buf.sx) < 0) {
|
||||
if (!ERRNO_IS_NOT_SUPPORTED(errno) && !ERRNO_IS_PRIVILEGE(errno))
|
||||
if (!ERRNO_IS_NOT_SUPPORTED(errno) && /* statx() is not supported by the kernel. */
|
||||
!ERRNO_IS_PRIVILEGE(errno) && /* maybe filtered by seccomp. */
|
||||
errno != EINVAL) /* glibc's fallback method returns EINVAL when AT_STATX_DONT_SYNC is set. */
|
||||
return -errno;
|
||||
|
||||
/* Fall back to name_to_handle_at() and then fdinfo if statx is not supported or we lack
|
||||
|
||||
Reference in New Issue
Block a user