diff options
| author | Po Lu | 2023-06-08 14:04:31 +0800 |
|---|---|---|
| committer | Po Lu | 2023-06-08 14:04:31 +0800 |
| commit | b1bd40dce197d2938426d1ec33cebd3d51ccc8cf (patch) | |
| tree | 610f3c3b69d878d62584ad6da607c2c5499bd45f /src/fileio.c | |
| parent | f2b2863ff7380e7c3c31662ca7615bd8edb83440 (diff) | |
| download | emacs-b1bd40dce197d2938426d1ec33cebd3d51ccc8cf.tar.gz emacs-b1bd40dce197d2938426d1ec33cebd3d51ccc8cf.zip | |
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.
Diffstat (limited to 'src/fileio.c')
| -rw-r--r-- | src/fileio.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/fileio.c b/src/fileio.c index f2f440d0a3b..fbccd796751 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -56,9 +56,9 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 56 | #include "region-cache.h" | 56 | #include "region-cache.h" |
| 57 | #include "frame.h" | 57 | #include "frame.h" |
| 58 | 58 | ||
| 59 | #if defined HAVE_ANDROID | 59 | #ifdef HAVE_ANDROID |
| 60 | #include "android.h" | 60 | #include "android.h" |
| 61 | #endif | 61 | #endif /* HAVE_ANDROID */ |
| 62 | 62 | ||
| 63 | #ifdef HAVE_LINUX_FS_H | 63 | #ifdef HAVE_LINUX_FS_H |
| 64 | # include <sys/ioctl.h> | 64 | # include <sys/ioctl.h> |
| @@ -193,9 +193,11 @@ static void | |||
| 193 | check_mutable_filename (Lisp_Object encoded, bool write) | 193 | check_mutable_filename (Lisp_Object encoded, bool write) |
| 194 | { | 194 | { |
| 195 | #if defined HAVE_ANDROID && !defined ANDROID_STUBIFY | 195 | #if defined HAVE_ANDROID && !defined ANDROID_STUBIFY |
| 196 | if (!strcmp (SSDATA (encoded), "/assets") | 196 | const char *name; |
| 197 | || !strncmp (SSDATA (encoded), "/assets/", | 197 | |
| 198 | sizeof "/assets/" - 1)) | 198 | name = SSDATA (encoded); |
| 199 | |||
| 200 | if (android_is_special_directory (name, "/assets")) | ||
| 199 | xsignal2 (Qfile_error, | 201 | xsignal2 (Qfile_error, |
| 200 | build_string ("File lies on read-only directory"), | 202 | build_string ("File lies on read-only directory"), |
| 201 | encoded); | 203 | encoded); |
| @@ -203,13 +205,11 @@ check_mutable_filename (Lisp_Object encoded, bool write) | |||
| 203 | if (write) | 205 | if (write) |
| 204 | return; | 206 | return; |
| 205 | 207 | ||
| 206 | if (!strcmp (SSDATA (encoded), "/content") | 208 | if (android_is_special_directory (name, "/content")) |
| 207 | || !strncmp (SSDATA (encoded), "/content/", | ||
| 208 | sizeof "/content/" - 1)) | ||
| 209 | xsignal2 (Qfile_error, | 209 | xsignal2 (Qfile_error, |
| 210 | build_string ("File lies on read-only directory"), | 210 | build_string ("File lies on read-only directory"), |
| 211 | encoded); | 211 | encoded); |
| 212 | #endif | 212 | #endif /* defined HAVE_ANDROID && !defined ANDROID_STUBIFY */ |
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | 215 | ||