X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fmain.c;h=91bd5d688de66a3280ae14a61444931c3fe58eae;hb=4be3178d4d360c2996217d811e61161c84d25898;hp=2bda27c501fd0685a5f498f5e1960ac0e00fe809;hpb=f0f7cb74780314dff1fae99079e01a45728219fb;p=i3%2Fi3 diff --git a/src/main.c b/src/main.c index 2bda27c5..91bd5d68 100644 --- a/src/main.c +++ b/src/main.c @@ -261,9 +261,11 @@ int main(int argc, char *argv[]) { } if (config.ipc_socket_path == NULL) { - config.ipc_socket_path = getenv("I3SOCK"); - if (config.ipc_socket_path == NULL) - config.ipc_socket_path = get_process_filename("i3-ipc-socket"); + /* Fall back to a file name in /tmp/ based on the PID */ + if ((config.ipc_socket_path = getenv("I3SOCK")) == NULL) + config.ipc_socket_path = get_process_filename("ipc-socket"); + else + config.ipc_socket_path = sstrdup(config.ipc_socket_path); } uint32_t mask = XCB_CW_EVENT_MASK; @@ -388,6 +390,7 @@ int main(int argc, char *argv[]) { if (ipc_socket == -1) { ELOG("Could not create the IPC socket, IPC disabled\n"); } else { + free(config.ipc_socket_path); struct ev_io *ipc_io = scalloc(sizeof(struct ev_io)); ev_io_init(ipc_io, ipc_new_client, ipc_socket, EV_READ); ev_io_start(loop, ipc_io);