mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-07 04:06:07 -05:00
main: --server: don’t exit with code 0 on failure
A foot --server instance would exit with code 0, even on failure, if the number of currently open terminal instances were 0. This is because ‘ret’ assumed failure, and then tried to set it to ‘success’ after the even loop had terminated, basted on the server’s current state. Fix by: * set ‘ret’ to success just before entering the event loop * set ‘ret’ to failure when we detect an FDM failure * don’t try to second-guess success/failure after having exited the event loop Closes #943
This commit is contained in:
parent
6940d2047e
commit
8fa16f616c
2 changed files with 7 additions and 4 deletions
|
|
@ -69,6 +69,9 @@
|
|||
(https://codeberg.org/dnkl/foot/issues/924).
|
||||
* Crash in `pipe-scrollback`
|
||||
(https://codeberg.org/dnkl/foot/issues/926).
|
||||
* Exit code being 0 when a foot server with no open windows terminate
|
||||
due to e.g. a Wayland connection failure
|
||||
(https://codeberg.org/dnkl/foot/issues/943).
|
||||
|
||||
|
||||
### Security
|
||||
|
|
|
|||
8
main.c
8
main.c
|
|
@ -642,14 +642,14 @@ main(int argc, char *const *argv)
|
|||
goto out;
|
||||
}
|
||||
|
||||
ret = EXIT_SUCCESS;
|
||||
while (likely(!aborted && (as_server || tll_length(wayl->terms) > 0))) {
|
||||
if (unlikely(!fdm_poll(fdm)))
|
||||
if (unlikely(!fdm_poll(fdm))) {
|
||||
ret = foot_exit_failure;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (aborted || tll_length(wayl->terms) == 0)
|
||||
ret = EXIT_SUCCESS;
|
||||
|
||||
out:
|
||||
free(_cwd);
|
||||
server_destroy(server);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue