launch_daemon: Don't allow restarting.

* Check if the port already exists on startup. This fixes #12901.
This commit is contained in:
Axel Dörfler
2017-04-07 18:01:14 +02:00
parent 99ccb18d97
commit bc600adbd8
+6 -1
View File
@@ -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.
*/
@@ -1942,6 +1942,11 @@ open_stdio(int targetFD, int openMode)
int
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
open_stdio(STDIN_FILENO, O_RDONLY);
open_stdio(STDOUT_FILENO, O_WRONLY);