Fixes for small existing bugs.

This commit is contained in:
Connor E 2019-01-16 10:18:46 +00:00 committed by emersion
parent de6f5b3453
commit 70637b40fe
2 changed files with 3 additions and 2 deletions

View file

@ -13,7 +13,7 @@
void ipc_send_workspace_command(struct swaybar *bar, const char *ws) { void ipc_send_workspace_command(struct swaybar *bar, const char *ws) {
const char *fmt = "workspace \"%s\""; const char *fmt = "workspace \"%s\"";
uint32_t size = snprintf(NULL, 0, fmt, ws); 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); snprintf(command, size, fmt, ws);
ipc_single_command(bar->ipc_socketfd, IPC_COMMAND, command, &size); ipc_single_command(bar->ipc_socketfd, IPC_COMMAND, command, &size);
free(command); free(command);

View file

@ -31,8 +31,9 @@ static bool terminal_execute(char *terminal, char *command) {
char *cmd = malloc(sizeof(char) * (strlen(terminal) + strlen(" -e ") + strlen(fname) + 1)); char *cmd = malloc(sizeof(char) * (strlen(terminal) + strlen(" -e ") + strlen(fname) + 1));
sprintf(cmd, "%s -e %s", terminal, fname); sprintf(cmd, "%s -e %s", terminal, fname);
execl("/bin/sh", "/bin/sh", "-c", cmd, NULL); execl("/bin/sh", "/bin/sh", "-c", cmd, NULL);
wlr_log_errno(WLR_ERROR, "Failed to run command, execl() returned.");
free(cmd); free(cmd);
return true; return false;
} }
static void swaynag_button_execute(struct swaynag *swaynag, static void swaynag_button_execute(struct swaynag *swaynag,