Merge pull request #4647 from psychon/refuse-start-without-ipc-socket

Refuse to start without IPC socket
This commit is contained in:
Orestis Floros
2021-11-02 23:13:52 +01:00
committed by GitHub

View File

@ -683,6 +683,11 @@ int main(int argc, char *argv[]) {
else else
config.ipc_socket_path = sstrdup(config.ipc_socket_path); config.ipc_socket_path = sstrdup(config.ipc_socket_path);
} }
/* Create the UNIX domain socket for IPC */
int ipc_socket = create_socket(config.ipc_socket_path, &current_socketpath);
if (ipc_socket == -1) {
die("Could not create the IPC socket: %s", config.ipc_socket_path);
}
if (config.force_xinerama) { if (config.force_xinerama) {
force_xinerama = true; force_xinerama = true;
@ -988,15 +993,10 @@ int main(int argc, char *argv[]) {
tree_render(); tree_render();
/* Create the UNIX domain socket for IPC */ /* Listen to the IPC socket for clients */
int ipc_socket = create_socket(config.ipc_socket_path, &current_socketpath); struct ev_io *ipc_io = scalloc(1, sizeof(struct ev_io));
if (ipc_socket == -1) { ev_io_init(ipc_io, ipc_new_client, ipc_socket, EV_READ);
ELOG("Could not create the IPC socket, IPC disabled\n"); ev_io_start(main_loop, ipc_io);
} else {
struct ev_io *ipc_io = scalloc(1, sizeof(struct ev_io));
ev_io_init(ipc_io, ipc_new_client, ipc_socket, EV_READ);
ev_io_start(main_loop, ipc_io);
}
/* Chose a file name in /tmp/ based on the PID */ /* Chose a file name in /tmp/ based on the PID */
char *log_stream_socket_path = get_process_filename("log-stream-socket"); char *log_stream_socket_path = get_process_filename("log-stream-socket");