Fix gcc string truncation warnings

This commit is contained in:
Dominique Martinet 2018-04-13 22:35:23 +09:00
parent 54ae394754
commit 25af959fe9
4 changed files with 4 additions and 4 deletions

View file

@ -64,7 +64,7 @@ void ipc_init(struct sway_server *server) {
// We want to use socket name set by user, not existing socket from another sway instance.
if (getenv("SWAYSOCK") != NULL && access(getenv("SWAYSOCK"), F_OK) == -1) {
strncpy(ipc_sockaddr->sun_path, getenv("SWAYSOCK"), sizeof(ipc_sockaddr->sun_path));
strncpy(ipc_sockaddr->sun_path, getenv("SWAYSOCK"), sizeof(ipc_sockaddr->sun_path) - 1);
ipc_sockaddr->sun_path[sizeof(ipc_sockaddr->sun_path) - 1] = 0;
}