diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-01-31 22:34:48 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-01-31 22:34:48 -0700 |
commit | d4d613629b59d2eadd80026cab6c9dabc92cab24 (patch) | |
tree | d31086a817251dddb847d027661d218c1ecd6540 /src/emacs.c | |
parent | fdb813e529602914360fc2d0cf22e42e32e6905f (diff) | |
parent | a5438ee11ad052e71334dcfb2db51fb9123411e5 (diff) | |
download | emacs-d4d613629b59d2eadd80026cab6c9dabc92cab24.tar.gz |
Merge remote-tracking branch 'origin/master' into athena/unstable
Diffstat (limited to 'src/emacs.c')
-rw-r--r-- | src/emacs.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/emacs.c b/src/emacs.c index 77114271b27..fd08667f3fd 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -186,7 +186,8 @@ bool build_details; /* Name for the server started by the daemon.*/ static char *daemon_name; -/* 0 not a daemon, 1 new-style (foreground), 2 old-style (background). */ +/* 0 not a daemon, 1 new-style (foreground), 2 old-style (background). + A negative value means the daemon initialization was already done. */ int daemon_type; #ifndef WINDOWSNT @@ -2354,7 +2355,10 @@ all of which are called before Emacs is actually killed. */ int exit_code; #ifdef HAVE_LIBSYSTEMD - sd_notify(0, "STOPPING=1"); + /* Notify systemd we are shutting down, but only if we have notified + it about startup. */ + if (daemon_type == -1) + sd_notify(0, "STOPPING=1"); #endif /* HAVE_LIBSYSTEMD */ /* Fsignal calls emacs_abort () if it sees that waiting_for_input is @@ -2866,7 +2870,7 @@ from the parent process and its tty file descriptors. */) } /* Set it to an invalid value so we know we've already run this function. */ - daemon_type = -1; + daemon_type = -daemon_type; #else /* WINDOWSNT */ /* Signal the waiting emacsclient process. */ |