commit 70637b40fe98bda420e279e2e059fc93a9f538d6
parent de6f5b345380e80b4d59ebc569697683af064424
Author: Connor E <38229097+c-edw@users.noreply.github.com>
Date: Wed, 16 Jan 2019 10:18:46 +0000
Fixes for small existing bugs.
Diffstat:
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/swaybar/ipc.c b/swaybar/ipc.c
@@ -13,7 +13,7 @@
void ipc_send_workspace_command(struct swaybar *bar, const char *ws) {
const char *fmt = "workspace \"%s\"";
uint32_t size = snprintf(NULL, 0, fmt, ws);
- char *command = malloc(sizeof(char) * size);
+ char *command = malloc(sizeof(char) * (size + 1));
snprintf(command, size, fmt, ws);
ipc_single_command(bar->ipc_socketfd, IPC_COMMAND, command, &size);
free(command);
diff --git a/swaynag/swaynag.c b/swaynag/swaynag.c
@@ -31,8 +31,9 @@ static bool terminal_execute(char *terminal, char *command) {
char *cmd = malloc(sizeof(char) * (strlen(terminal) + strlen(" -e ") + strlen(fname) + 1));
sprintf(cmd, "%s -e %s", terminal, fname);
execl("/bin/sh", "/bin/sh", "-c", cmd, NULL);
+ wlr_log_errno(WLR_ERROR, "Failed to run command, execl() returned.");
free(cmd);
- return true;
+ return false;
}
static void swaynag_button_execute(struct swaynag *swaynag,