From 1bf8fd61c5c4781a4f00ea4a4465915c04dcb659 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Wed, 8 Mar 2023 21:18:50 +0800 Subject: [PATCH] Update Android port * src/fileio.c (Fcopy_file): On Android, ignore ENOSYS and ENOTSUP when restoring file times, as the system call used is supported by many kernels. --- src/fileio.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/fileio.c b/src/fileio.c index 88582704d7e..99f710ccbf0 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2495,7 +2495,17 @@ permissions. */) struct timespec ts[2]; ts[0] = get_stat_atime (&st); ts[1] = get_stat_mtime (&st); - if (futimens (ofd, ts) != 0) + if (futimens (ofd, ts) != 0 + /* Various versions of the Android C library are missing + futimens, which leads a gnulib fallback to be installed + that uses fdutimens instead. However, fdutimens is not + supported on many Android kernels, so just silently fail + if errno is ENOTSUP or ENOSYS. */ +#if defined HAVE_ANDROID && !defined ANDROID_STUBIFY + && errno != ENOTSUP + && errno != ENOSYS +#endif + ) xsignal2 (Qfile_date_error, build_string ("Cannot set file date"), newname); } -- 2.39.5