diff options
| author | Jens Schmidt | 2025-04-02 22:48:31 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2025-04-13 11:33:30 +0300 |
| commit | e82989757f42e95bf72a2a55de415a8162a55dc3 (patch) | |
| tree | a403b48a17f89cc6a001eeeaad84a4e4e5c685bb /src/sysdep.c | |
| parent | 5665b446b7a5b2f6ff4d4e7ea9b2c91e0e733c92 (diff) | |
| download | emacs-e82989757f42e95bf72a2a55de415a8162a55dc3.tar.gz emacs-e82989757f42e95bf72a2a55de415a8162a55dc3.zip | |
Use a pristine copy of argv to restart Emacs
argv as left after main has proccessed the command-line can differ
both in order and contents of the original command-line arguments,
which can lead to surprising results when restarting emacs on the
cooked argv through `kill-emacs'.
Starting from that observation, consistenly use variables
'initial_cmdline' on Windows, 'initial_argc', 'initial_argv' on
non-Windows, and 'initial_argv0' in all ports.
* src/lisp.h: Declare 'initial_argv0', limit declaration of
'initial_argv' and 'initial_argc' to non-Windows ports.
* src/emacs.c: Likewise, but for the definitions.
(init_cmdargs): Move initialization of 'initial_argv' and
'initial_argc' ...
(copy_args) [!WINDOWSNT]: ... to this new function ...
(main): ... and call that in 'main', also initializing
'initial_argv0' before the command-line processing.
* src/emacs.c (Fkill_emacs):
* src/pgtkterm.c (pgtk_term_init):
* src/sysdep.c (emacs_perror):
* src/xterm.c (x_term_init): Use 'initial_argv0' where only that
is required. (Bug#77389)
Diffstat (limited to 'src/sysdep.c')
| -rw-r--r-- | src/sysdep.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/sysdep.c b/src/sysdep.c index a161b4af100..042de2acf80 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -2854,8 +2854,7 @@ emacs_perror (char const *message) | |||
| 2854 | { | 2854 | { |
| 2855 | int err = errno; | 2855 | int err = errno; |
| 2856 | char const *error_string = emacs_strerror (err); | 2856 | char const *error_string = emacs_strerror (err); |
| 2857 | char const *command = (initial_argv && initial_argv[0] | 2857 | char const *command = (initial_argv0 ? initial_argv0 : "emacs"); |
| 2858 | ? initial_argv[0] : "emacs"); | ||
| 2859 | /* Write it out all at once, if it's short; this is less likely to | 2858 | /* Write it out all at once, if it's short; this is less likely to |
| 2860 | be interleaved with other output. */ | 2859 | be interleaved with other output. */ |
| 2861 | char buf[min (PIPE_BUF, MAX_ALLOCA)]; | 2860 | char buf[min (PIPE_BUF, MAX_ALLOCA)]; |