From 56d5a4079423aa22d2203a342439df7359eb1c18 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 17 Apr 2022 15:46:24 +0200 Subject: [PATCH] Add a `restart-emacs' sanity check * src/emacs.c (Fkill_emacs): Add a sanity check for argv. --- src/emacs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/emacs.c b/src/emacs.c index 173e8e8923d..a16e702ab7b 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -2807,6 +2807,10 @@ killed. */ if (!NILP (restart)) { + /* This is very unlikely, but it's possible to execute a binary + (on some systems) with no argv. */ + if (initial_argc < 1) + error ("No command line arguments known; unable to re-execute Emacs"); if (execvp (*initial_argv, initial_argv) < 1) error ("Unable to re-execute Emacs"); } -- 2.39.2