Backport !3482 “glocalfileinfo: Fix incorrect use of struct statx.st_mtimensec on Android” to glib-2-76
GLocalFileStat is a platform-specific abstraction around struct stat
or struct statx. If struct statx is available, it will use that by
preference as it has more features.
glocalfileinfo.c was, in some places, incorrectly accessing the fields
of GLocalFileStat directly rather than through its _g_stat_*()
getters. While it correctly accounted for the platform-specific
differences between st_mtimensec and st_mtim.tv_nsec, it hadn’t been
updated to deal with stx_mtime.
On Android, st_mtimensec is defined as a fallback for
st_mtim.tv_nsec (even though it doesn’t need to be). This caused GLib
to take the st_mtimensec code path rather than the stx_mtime code
path, and hence try to dereference st_mtim in a struct statx.
Fix that by correctly using the _g_stat_*() getters consistently.
Signed-off-by: Philip Withnall pwithnall@endlessos.org
Fixes: #3039 (closed)
Trivial backport of !3482 (merged) to glib-2-76.