mirror of
https://github.com/swaywm/sway.git
synced 2025-10-29 05:40:18 -04:00
Remove usage of VLAs.
This commit is contained in:
parent
02bbefda20
commit
aa9d7d8ca1
7 changed files with 32 additions and 11 deletions
|
|
@ -365,11 +365,12 @@ int swaynag_load_config(char *path, struct swaynag *swaynag, list_t *types) {
|
|||
}
|
||||
free(name);
|
||||
} else {
|
||||
char flag[nread + 3];
|
||||
char *flag = malloc(sizeof(char) * (nread + 3));
|
||||
sprintf(flag, "--%s", line);
|
||||
char *argv[] = {"swaynag", flag};
|
||||
result = swaynag_parse_options(2, argv, swaynag, types, type,
|
||||
NULL, NULL);
|
||||
free(flag);
|
||||
if (result != 0) {
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,9 +28,10 @@ static bool terminal_execute(char *terminal, char *command) {
|
|||
fprintf(tmp, "#!/bin/sh\nrm %s\n%s", fname, command);
|
||||
fclose(tmp);
|
||||
chmod(fname, S_IRUSR | S_IWUSR | S_IXUSR);
|
||||
char cmd[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);
|
||||
execl("/bin/sh", "/bin/sh", "-c", cmd, NULL);
|
||||
free(cmd);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue