launch_daemon: Don't allow restarting.
* Check if the port already exists on startup. This fixes #12901.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2015-2016, Axel Dörfler, [email protected].
|
* Copyright 2015-2017, Axel Dörfler, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -1942,6 +1942,11 @@ open_stdio(int targetFD, int openMode)
|
|||||||
int
|
int
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
|
if (find_port(B_LAUNCH_DAEMON_PORT_NAME) >= 0) {
|
||||||
|
fprintf(stderr, "The launch_daemon is already running!\n");
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
// Make stdin/out/err available
|
// Make stdin/out/err available
|
||||||
open_stdio(STDIN_FILENO, O_RDONLY);
|
open_stdio(STDIN_FILENO, O_RDONLY);
|
||||||
open_stdio(STDOUT_FILENO, O_WRONLY);
|
open_stdio(STDOUT_FILENO, O_WRONLY);
|
||||||
|
|||||||
Reference in New Issue
Block a user