diff options
| author | Paul Eggert | 2025-07-24 05:32:37 -0700 |
|---|---|---|
| committer | Paul Eggert | 2025-07-24 22:13:47 -0700 |
| commit | d59fe6dad5667720b296569d2f6fe1b84d42fd0a (patch) | |
| tree | cfdc9330b50818719ffa753f1b636ce5b8800812 /src | |
| parent | 67ea9485a65dee4fb654f1bc177c71028d020607 (diff) | |
| download | emacs-d59fe6dad5667720b296569d2f6fe1b84d42fd0a.tar.gz emacs-d59fe6dad5667720b296569d2f6fe1b84d42fd0a.zip | |
Treat ‘.../emacs’ like ‘emacs’ in realpath startup
* src/emacs.c (find_emacs_executable): If the executable name
contains a slash, use the same optimization for symlink resolution
that we already use when the executable name has no slash.
Diffstat (limited to 'src')
| -rw-r--r-- | src/emacs.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/emacs.c b/src/emacs.c index 0e10398dc78..3689c92c8b2 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -767,15 +767,11 @@ find_emacs_executable (char const *argv0, ptrdiff_t *candidate_size) | |||
| 767 | eassert (argv0); | 767 | eassert (argv0); |
| 768 | if (strchr (argv0, DIRECTORY_SEP)) | 768 | if (strchr (argv0, DIRECTORY_SEP)) |
| 769 | { | 769 | { |
| 770 | char *real_name = realpath (argv0, NULL); | 770 | char *val = (readlink (argv0, linkbuf, sizeof linkbuf) < 0 |
| 771 | 771 | ? NULL | |
| 772 | if (real_name) | 772 | : realpath (argv0, NULL)); |
| 773 | { | 773 | if (!val) |
| 774 | *candidate_size = strlen (real_name) + 1; | 774 | val = xstrdup (argv0); |
| 775 | return real_name; | ||
| 776 | } | ||
| 777 | |||
| 778 | char *val = xstrdup (argv0); | ||
| 779 | *candidate_size = strlen (val) + 1; | 775 | *candidate_size = strlen (val) + 1; |
| 780 | return val; | 776 | return val; |
| 781 | } | 777 | } |