emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/native-comp a9b9ada: Fix crash on MS-Windows caused by recent ch


From: Eli Zaretskii
Subject: feature/native-comp a9b9ada: Fix crash on MS-Windows caused by recent changes
Date: Wed, 7 Apr 2021 12:45:03 -0400 (EDT)

branch: feature/native-comp
commit a9b9ada6bf5e07da75ddeba6fd985e28987b767b
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix crash on MS-Windows caused by recent changes
    
    * src/pdumper.c (dump_do_dump_relocation): Don't use
    expand-file-name, as this crashes on MS-Windows.  Use
    file_access_p instead of emacs_fopen.
---
 src/pdumper.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/pdumper.c b/src/pdumper.c
index 9b750a3..dc893c5 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -5276,12 +5276,13 @@ dump_do_dump_relocation (const uintptr_t dump_base,
        /* Check just once if this is a local build or Emacs was installed.  */
        if (installation_state == UNKNOWN)
          {
+           /* Can't use expand-file-name here, because we are too
+              early in the startup, and we will crash at least on
+              WINDOWSNT.  */
            Lisp_Object fname =
-             Fexpand_file_name (XCAR (comp_u->file), Vinvocation_directory);
-           FILE *file;
-           if ((file = emacs_fopen (SSDATA (ENCODE_FILE (fname)), "r")))
+             concat2 (Vinvocation_directory, XCAR (comp_u->file));
+           if (file_access_p (SSDATA (ENCODE_FILE (fname)), F_OK))
              {
-               fclose (file);
                installation_state = INSTALLED;
                fixup_eln_load_path (XCAR (comp_u->file));
              }
@@ -5293,10 +5294,10 @@ dump_do_dump_relocation (const uintptr_t dump_base,
          }
 
        comp_u->file =
-         Fexpand_file_name (installation_state == INSTALLED
-                            ? XCAR (comp_u->file) : XCDR (comp_u->file),
-                            Vinvocation_directory);
-       comp_u->handle = dynlib_open (SSDATA (comp_u->file));
+         concat2 (Vinvocation_directory,
+                  installation_state == INSTALLED
+                  ? XCAR (comp_u->file) : XCDR (comp_u->file));
+       comp_u->handle = dynlib_open (SSDATA (ENCODE_FILE (comp_u->file)));
        if (!comp_u->handle)
          error ("%s", dynlib_error ());
        load_comp_unit (comp_u, true, false);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]