diff options
| author | Andrea Corallo | 2020-09-10 09:59:29 +0200 |
|---|---|---|
| committer | Andrea Corallo | 2020-09-10 10:55:25 +0200 |
| commit | cb293cfb929dfbecb3057dde2115399b89350a9b (patch) | |
| tree | 870c7279b8179889e98cbc8ef1e7eaf72b962184 /src | |
| parent | a26b14733bba6659548f00db634bc45ccd222447 (diff) | |
| download | emacs-cb293cfb929dfbecb3057dde2115399b89350a9b.tar.gz emacs-cb293cfb929dfbecb3057dde2115399b89350a9b.zip | |
* Guard against trying to rename files into eln sys directory
* src/comp.c (file_in_eln_sys_dir): New function.
(Fnative_elisp_load): Make use of.
Diffstat (limited to 'src')
| -rw-r--r-- | src/comp.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/comp.c b/src/comp.c index 4550833a6a2..d7966d42221 100644 --- a/src/comp.c +++ b/src/comp.c | |||
| @@ -4912,6 +4912,18 @@ DEFUN ("comp--late-register-subr", Fcomp__late_register_subr, | |||
| 4912 | return Qnil; | 4912 | return Qnil; |
| 4913 | } | 4913 | } |
| 4914 | 4914 | ||
| 4915 | static bool | ||
| 4916 | file_in_eln_sys_dir (Lisp_Object filename) | ||
| 4917 | { | ||
| 4918 | Lisp_Object eln_sys_dir = Qnil; | ||
| 4919 | Lisp_Object tmp = Vcomp_eln_load_path; | ||
| 4920 | FOR_EACH_TAIL (tmp) | ||
| 4921 | eln_sys_dir = XCAR (tmp); | ||
| 4922 | return !NILP (Fstring_match (Fregexp_quote (Fexpand_file_name (eln_sys_dir, | ||
| 4923 | Qnil)), | ||
| 4924 | Fexpand_file_name (filename, Qnil), Qnil)); | ||
| 4925 | } | ||
| 4926 | |||
| 4915 | /* Load related routines. */ | 4927 | /* Load related routines. */ |
| 4916 | DEFUN ("native-elisp-load", Fnative_elisp_load, Snative_elisp_load, 1, 2, 0, | 4928 | DEFUN ("native-elisp-load", Fnative_elisp_load, Snative_elisp_load, 1, 2, 0, |
| 4917 | doc: /* Load native elisp code FILENAME. | 4929 | doc: /* Load native elisp code FILENAME. |
| @@ -4926,6 +4938,7 @@ DEFUN ("native-elisp-load", Fnative_elisp_load, Snative_elisp_load, 1, 2, 0, | |||
| 4926 | struct Lisp_Native_Comp_Unit *comp_u = allocate_native_comp_unit (); | 4938 | struct Lisp_Native_Comp_Unit *comp_u = allocate_native_comp_unit (); |
| 4927 | 4939 | ||
| 4928 | if (!NILP (Fgethash (filename, all_loaded_comp_units_h, Qnil)) | 4940 | if (!NILP (Fgethash (filename, all_loaded_comp_units_h, Qnil)) |
| 4941 | && !file_in_eln_sys_dir (filename) | ||
| 4929 | && !NILP (Ffile_writable_p (filename))) | 4942 | && !NILP (Ffile_writable_p (filename))) |
| 4930 | { | 4943 | { |
| 4931 | /* If in this session there was ever a file loaded with this | 4944 | /* If in this session there was ever a file loaded with this |