]> git.eshelyaron.com Git - emacs.git/commitdiff
Disable Ffile_system_info for Android special directories
authorPo Lu <luangruo@yahoo.com>
Sun, 23 Jun 2024 08:41:36 +0000 (16:41 +0800)
committerEshel Yaron <me@eshelyaron.com>
Mon, 24 Jun 2024 07:07:24 +0000 (09:07 +0200)
* src/fileio.c (Ffile_system_info): Return Qnil if FILENAME
refers to a special directory.

(cherry picked from commit 60475a73d17d293f5c1e82bc5b3c058b414266e8)

src/fileio.c

index 9955f83e6252206b0f43133f2ee45a73d6b2d844..7afe3e757370a085b38b95a4981fd87aadbc62a6 100644 (file)
@@ -6531,7 +6531,18 @@ If the underlying system call fails, value is nil.  */)
   || defined STAT_STATFS4 || defined STAT_STATVFS              \
   || defined STAT_STATVFS64
   struct fs_usage u;
-  if (get_fs_usage (SSDATA (ENCODE_FILE (filename)), NULL, &u) != 0)
+  const char *name;
+
+  name = SSDATA (ENCODE_FILE (filename));
+
+#if defined HAVE_ANDROID && !defined ANDROID_STUBIFY
+  /* With special directories, this information is unavailable.  */
+  if (android_is_special_directory (name, "/assets")
+      || android_is_special_directory (name, "/content"))
+    return Qnil;
+#endif /* defined HAVE_ANDROID && !defined ANDROID_STUBIFY */
+
+  if (get_fs_usage (name, NULL, &u) != 0)
     return errno == ENOSYS ? Qnil : file_attribute_errno (filename, errno);
   return list3 (blocks_to_bytes (u.fsu_blocksize, u.fsu_blocks, false),
                blocks_to_bytes (u.fsu_blocksize, u.fsu_bfree, false),