1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-05 19:31:02 -08:00

Update Android port

* src/android.c (android_is_special_directory): New function.
(android_get_asset_name, android_content_name_p)
(android_get_content_name):
* src/android.h (android_is_special_directory)
(JNI_STACK_ALIGNMENT_PROLOGUE):
* src/fileio.c (check_mutable_filename):
* src/filelock.c (WTMP_FILE, make_lock_file_name):
* src/inotify.c (IN_ONLYDIR, Finotify_add_watch): Factor out
checks against asset and content directories to that function.
This commit is contained in:
Po Lu 2023-06-08 14:04:31 +08:00
parent f2b2863ff7
commit b1bd40dce1
5 changed files with 104 additions and 43 deletions

View file

@ -56,9 +56,9 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include "region-cache.h"
#include "frame.h"
#if defined HAVE_ANDROID
#ifdef HAVE_ANDROID
#include "android.h"
#endif
#endif /* HAVE_ANDROID */
#ifdef HAVE_LINUX_FS_H
# include <sys/ioctl.h>
@ -193,9 +193,11 @@ static void
check_mutable_filename (Lisp_Object encoded, bool write)
{
#if defined HAVE_ANDROID && !defined ANDROID_STUBIFY
if (!strcmp (SSDATA (encoded), "/assets")
|| !strncmp (SSDATA (encoded), "/assets/",
sizeof "/assets/" - 1))
const char *name;
name = SSDATA (encoded);
if (android_is_special_directory (name, "/assets"))
xsignal2 (Qfile_error,
build_string ("File lies on read-only directory"),
encoded);
@ -203,13 +205,11 @@ check_mutable_filename (Lisp_Object encoded, bool write)
if (write)
return;
if (!strcmp (SSDATA (encoded), "/content")
|| !strncmp (SSDATA (encoded), "/content/",
sizeof "/content/" - 1))
if (android_is_special_directory (name, "/content"))
xsignal2 (Qfile_error,
build_string ("File lies on read-only directory"),
encoded);
#endif
#endif /* defined HAVE_ANDROID && !defined ANDROID_STUBIFY */
}