mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-11-23 10:49:02 +01:00
glocalfile: Complain if faccessat sets an unusual error
Many libc implementations seem to be incompatible with this optimisation. Printing an error when the error is either `EINVAL` or `EBADF` should make it easier to identify any more problematic platforms.
This commit is contained in:
@@ -1280,7 +1280,19 @@ g_local_file_query_exists (GFile *file,
|
||||
{
|
||||
GLocalFile *local = G_LOCAL_FILE (file);
|
||||
|
||||
return faccessat (0, local->filename, F_OK, AT_EACCESS | AT_SYMLINK_NOFOLLOW) == 0;
|
||||
if (faccessat (0, local->filename, F_OK, AT_EACCESS | AT_SYMLINK_NOFOLLOW) == 0)
|
||||
return TRUE;
|
||||
|
||||
if G_UNLIKELY (errno == EBADF)
|
||||
{
|
||||
g_critical ("g_local_file_query_exists: faccessat didn't accept supplied dirfd");
|
||||
}
|
||||
else if G_UNLIKELY (errno == EINVAL)
|
||||
{
|
||||
g_critical ("g_local_file_query_exists: faccessat doesn't support supplied flags");
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user