If the socket path isn't specified, write it to /tmp.

This commit is contained in:
Fernando Tarlá Cardoso Lemos 2011-03-21 09:05:58 -03:00 committed by Michael Stapelberg
parent 39ee97fd82
commit f0f7cb7478
1 changed files with 9 additions and 9 deletions

View File

@ -262,6 +262,8 @@ int main(int argc, char *argv[]) {
if (config.ipc_socket_path == NULL) { if (config.ipc_socket_path == NULL) {
config.ipc_socket_path = getenv("I3SOCK"); config.ipc_socket_path = getenv("I3SOCK");
if (config.ipc_socket_path == NULL)
config.ipc_socket_path = get_process_filename("i3-ipc-socket");
} }
uint32_t mask = XCB_CW_EVENT_MASK; uint32_t mask = XCB_CW_EVENT_MASK;
@ -382,7 +384,6 @@ int main(int argc, char *argv[]) {
die("Could not initialize libev. Bad LIBEV_FLAGS?\n"); die("Could not initialize libev. Bad LIBEV_FLAGS?\n");
/* Create the UNIX domain socket for IPC */ /* Create the UNIX domain socket for IPC */
if (config.ipc_socket_path != NULL) {
int ipc_socket = ipc_create_socket(config.ipc_socket_path); int ipc_socket = ipc_create_socket(config.ipc_socket_path);
if (ipc_socket == -1) { if (ipc_socket == -1) {
ELOG("Could not create the IPC socket, IPC disabled\n"); ELOG("Could not create the IPC socket, IPC disabled\n");
@ -391,7 +392,6 @@ int main(int argc, char *argv[]) {
ev_io_init(ipc_io, ipc_new_client, ipc_socket, EV_READ); ev_io_init(ipc_io, ipc_new_client, ipc_socket, EV_READ);
ev_io_start(loop, ipc_io); ev_io_start(loop, ipc_io);
} }
}
/* Set up i3 specific atoms like I3_SOCKET_PATH and I3_CONFIG_PATH */ /* Set up i3 specific atoms like I3_SOCKET_PATH and I3_CONFIG_PATH */
x_set_i3_atoms(); x_set_i3_atoms();