aboutsummaryrefslogtreecommitdiffstats
path: root/src/xterm.c
diff options
context:
space:
mode:
authorJens Schmidt2025-04-02 22:48:31 +0200
committerEli Zaretskii2025-04-13 11:33:30 +0300
commite82989757f42e95bf72a2a55de415a8162a55dc3 (patch)
treea403b48a17f89cc6a001eeeaad84a4e4e5c685bb /src/xterm.c
parent5665b446b7a5b2f6ff4d4e7ea9b2c91e0e733c92 (diff)
downloademacs-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/xterm.c')
-rw-r--r--src/xterm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/xterm.c b/src/xterm.c
index b21efd5a2a2..18a9231e75a 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -30619,7 +30619,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
30619 argv[argc] = 0; 30619 argv[argc] = 0;
30620 30620
30621 argc = 0; 30621 argc = 0;
30622 argv[argc++] = initial_argv[0]; 30622 argv[argc++] = initial_argv0;
30623 30623
30624 if (! NILP (display_name)) 30624 if (! NILP (display_name))
30625 { 30625 {