emacs-diffs
[Top][All Lists]
Advanced

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

feature/native-comp fa65c04: Improve detection of pdumper file and *.eln


From: Eli Zaretskii
Subject: feature/native-comp fa65c04: Improve detection of pdumper file and *.eln files
Date: Sat, 24 Apr 2021 09:02:11 -0400 (EDT)

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

    Improve detection of pdumper file and *.eln files
    
    * src/emacs.c (load_pdump_find_executable): Resolve symlinks even
    if argv[0] includes leading directories.  (Bug#46790)
---
 src/emacs.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/emacs.c b/src/emacs.c
index 792f690..9157cd84 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -746,10 +746,18 @@ load_pdump_find_executable (char const *argv0, ptrdiff_t 
*candidate_size)
   char *candidate = NULL;
 
   /* If the executable name contains a slash, we have some kind of
-     path already, so just copy it.  */
+     path already, so just resolve symlinks and return the result.  */
   eassert (argv0);
   if (strchr (argv0, DIRECTORY_SEP))
     {
+      char *real_name = realpath (argv0, NULL);
+
+      if (real_name)
+       {
+         *candidate_size = strlen (real_name) + 1;
+         return real_name;
+       }
+
       char *val = xstrdup (argv0);
       *candidate_size = strlen (val) + 1;
       return val;



reply via email to

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