]> git.eshelyaron.com Git - emacs.git/commitdiff
remove old eln before creating a new one to prevent crashes
authorAndrea Corallo <akrl@sdf.org>
Sun, 17 Nov 2019 13:17:59 +0000 (14:17 +0100)
committerAndrea Corallo <akrl@sdf.org>
Wed, 1 Jan 2020 10:38:06 +0000 (11:38 +0100)
src/comp.c

index e5d703f769ff509497ae2e26e635fe9470152ee8..cbf38de29af5c0de2fbf74c297b01de25740832d 100644 (file)
@@ -3078,8 +3078,14 @@ DEFUN ("comp--compile-ctxt-to-file", Fcomp__compile_ctxt_to_file,
     gcc_jit_context_dump_reproducer_to_file (comp.ctxt, "comp_reproducer.c");
 
   AUTO_STRING (dot_so, NATIVE_ELISP_SUFFIX);
+
   Lisp_Object out_file = CALLN (Fconcat, ctxtname, dot_so);
 
+  /* Remove the old eln before creating the new one to get a new inode and
+     prevent crashes in case the old one is currently loaded.  */
+  if (!NILP (Ffile_exists_p (out_file)))
+    Fdelete_file (out_file, Qnil);
+
   gcc_jit_context_compile_to_file (comp.ctxt,
                                   GCC_JIT_OUTPUT_KIND_DYNAMIC_LIBRARY,
                                   SSDATA (out_file));