summaryrefslogtreecommitdiff
path: root/common/ipc-client.c
AgeCommit message (Collapse)AuthorLines
2019-05-27common/ipc-client: remove ipc recv timeout logFurkan Sahin-2/+0
This just removes the ipc recv timeout log statement in `ipc_recv_set_timeout`. The `tv_sec` field of `struct timeval` has varying types and/or sizes depending on the platform and architecture. On some of these, the current format string will cause compilation errors. Additionally, the log statement is not extremely useful and the function is currently only used by swaymsg, which has a hardcoded log level that will prevent it from even being shown, so there is no point in even keeping it.
2019-04-17swaymsg: add timeout and type checksFurkan Sahin-0/+10
This adds a 3 second timeout to the initial reply in swaymsg. This prevents swaymsg from hanging when `swaymsg -t get_{inputs,seats}` is used in i3. The timeout is removed when waiting for a subscribed event or monitoring for subscribed events. This also adds type checks to commands where i3 does not reply with all of the properties that sway does (such as `modes` in `get_outputs`). This is mostly just a behavioral adjustment since swaymsg should run on i3. When running under i3, some command reply's (such as the one for `get_outputs) may have more useful information in the raw json than the pretty printed version.
2019-01-20Replace wlr_log with sway_logFurkan Sahin-1/+1
This commit mostly duplicates the wlr_log functions, although with a sway_* prefix. (This is very similar to PR #2009.) However, the logging function no longer needs to be replaceable, so sway_log_init's second argument is used to set the exit callback for sway_abort. wlr_log_init is still invoked in sway/main.c This commit makes it easier to remove the wlroots dependency for the helper programs swaymsg, swaybg, swaybar, and swaynag.
2019-01-19Fix backup methods in get_socketpath for IPC clientFurkan Sahin-4/+12
Previously, the success of `getline` was tested by checking if the buffer it allocates is nonempty and has a nonzero first byte. As `getline` does not explicitly zero out its memory buffer, this may fail (e.g., with AddressSanitizer). Instead, we check that at least one character was returned on standard output. Also, trailing newlines (if present) are now removed.
2019-01-16Use static arrays where possible.Furkan Sahin-9/+7
2019-01-16Remove usage of VLAs.Furkan Sahin-2/+7
2018-12-09Remove readline.cFurkan Sahin-5/+6
All occurrences of read_line have been replaced by getline. peek_line has been absorbed into detect_brace.
2018-09-02prevent ub caused by misaligned stores/loadsFurkan Sahin-4/+4
2018-08-06ipc-client: fix memory leaks in get_socketpathFurkan Sahin-0/+2
2018-07-09Update for swaywm/wlroots#1126Furkan Sahin-1/+1
2018-04-13Fix gcc string truncation warningsFurkan Sahin-1/+1
2018-03-28Allow sway IPC clients to fall back to i3 socketFurkan Sahin-7/+25
2018-01-05sway: change all sway_log to wlr_logFurkan Sahin-1/+1
2017-03-10UnGNUify the codebaseFurkan Sahin-1/+2
2016-12-15Handle malloc failure in ipc_recv_responseFurkan Sahin-0/+13
2016-09-01Reorganize includesFurkan Sahin-7/+4
2016-08-30Fix to make ipc client code FreeBSD compatible.Furkan Sahin-1/+1
2016-05-01common: fix potential buffer overflowFurkan Sahin-1/+2
2016-03-22Abort when receiving 0 bytes in IPC callFurkan Sahin-1/+1
When sway crashes a swaybar process is sometimes left behind running at 100% CPU. This was caused by the swaybar trying to retrieve an IPC response from the closed sway socket. This patch fixes the problem by aborting when the socket has been closed (recv return 0). Fix #528
2016-01-03Add type to returned response.Furkan Sahin-7/+21
Makes `ipc_recv_response` return a struct with size, type and payload rather than just the payload string. This is useful if the type has to be checked on the client.
2015-12-13Subscribe to workspace change events and redrawFurkan Sahin-12/+19
2015-11-28Fix incorrect #include on ipc-client.cFurkan Sahin-1/+1
2015-11-27Add command line to swaygrabFurkan Sahin-10/+11
Also modifies IPC client so that we can work with persistent connections.
2015-11-27Move IPC client into common, refactor IPCFurkan Sahin-0/+78