diff options
| author | Jan Beich <jbeich@FreeBSD.org> | 2025-09-15 13:23:52 +0200 |
|---|---|---|
| committer | Jan Beich <jbeich@FreeBSD.org> | 2025-09-15 13:50:09 +0200 |
| commit | 747f2eaa05d4883affce21253a2ac25fbb296407 (patch) | |
| tree | 51d76fb9f16352f6c751672232e2933ce80e09ea | |
| parent | 2d6e34f9d399a8f54d148adcdcf5f26d19a47ff2 (diff) | |
x11-wm/sway: tabify patch to match existing style
(cherry picked from commit 6cb13b9258df45066de9ecc6f9bcdd8009f53301)
| -rw-r--r-- | x11-wm/sway/files/extra-patch-wordexp | 62 | ||||
| -rw-r--r-- | x11-wm/swayfx/files/extra-patch-wordexp | 62 |
2 files changed, 54 insertions, 70 deletions
diff --git a/x11-wm/sway/files/extra-patch-wordexp b/x11-wm/sway/files/extra-patch-wordexp index 1209fefbe87e..eb1f79f130f5 100644 --- a/x11-wm/sway/files/extra-patch-wordexp +++ b/x11-wm/sway/files/extra-patch-wordexp @@ -12,46 +12,38 @@ https://github.com/swaywm/sway/issues/8828#issuecomment-3290045852 #include "list.h" #include "log.h" #include "stringop.h" -@@ -318,11 +320,37 @@ bool expand_path(char **path) { - char *ptr = strstr(*path, " ") + 1; +@@ -319,7 +321,33 @@ bool expand_path(char **path) { memmove(ptr + 1, ptr, strlen(ptr) + 1); *ptr = '\\'; -- } + } - if (wordexp(*path, &p, 0) != 0 || p.we_wordv[0] == NULL) { -- wordfree(&p); -- return false; -- } -+ } + -+ // FreeBSD wordexp bug workaround: -+ // 1. Reset SIGCHLD handler -+ // 2. Run wordexp -+ // 3. Restore SIGCHLD handler and reap any processes that exited -+ struct sigaction prev_action; -+ struct sigaction new_action = { -+ .sa_flags = SA_RESETHAND, -+ }; -+ if (sigaction(SIGCHLD, &new_action, &prev_action) != 0) { -+ sway_log(SWAY_ERROR, "Restoring sigchild before wordexp failed"); -+ return false; -+ } ++ // FreeBSD wordexp bug workaround: ++ // 1. Reset SIGCHLD handler ++ // 2. Run wordexp ++ // 3. Restore SIGCHLD handler and reap any processes that exited ++ struct sigaction prev_action; ++ struct sigaction new_action = { ++ .sa_flags = SA_RESETHAND, ++ }; ++ if (sigaction(SIGCHLD, &new_action, &prev_action) != 0) { ++ sway_log(SWAY_ERROR, "Restoring sigchild before wordexp failed"); ++ return false; ++ } + -+ int res = wordexp(*path, &p, 0); ++ int res = wordexp(*path, &p, 0); + -+ if (sigaction(SIGCHLD, &prev_action, NULL) != 0) { -+ sway_log(SWAY_ERROR, "Restoring sigchild after wordexp failed"); -+ } ++ if (sigaction(SIGCHLD, &prev_action, NULL) != 0) { ++ sway_log(SWAY_ERROR, "Restoring sigchild after wordexp failed"); ++ } + -+ int status; -+ int wres; -+ do { -+ wres = waitpid(-1, &status, WNOHANG); -+ } while (wres > 0 || (wres == -1 && errno == EINTR)); ++ int status; ++ int wres; ++ do { ++ wres = waitpid(-1, &status, WNOHANG); ++ } while (wres > 0 || (wres == -1 && errno == EINTR)); + -+ if (res != 0 || p.we_wordv[0] == NULL) { -+ wordfree(&p); -+ return false; -+ } - free(*path); - *path = join_args(p.we_wordv, p.we_wordc); - wordfree(&p); ++ if (res != 0 || p.we_wordv[0] == NULL) { + wordfree(&p); + return false; + } diff --git a/x11-wm/swayfx/files/extra-patch-wordexp b/x11-wm/swayfx/files/extra-patch-wordexp index 1209fefbe87e..eb1f79f130f5 100644 --- a/x11-wm/swayfx/files/extra-patch-wordexp +++ b/x11-wm/swayfx/files/extra-patch-wordexp @@ -12,46 +12,38 @@ https://github.com/swaywm/sway/issues/8828#issuecomment-3290045852 #include "list.h" #include "log.h" #include "stringop.h" -@@ -318,11 +320,37 @@ bool expand_path(char **path) { - char *ptr = strstr(*path, " ") + 1; +@@ -319,7 +321,33 @@ bool expand_path(char **path) { memmove(ptr + 1, ptr, strlen(ptr) + 1); *ptr = '\\'; -- } + } - if (wordexp(*path, &p, 0) != 0 || p.we_wordv[0] == NULL) { -- wordfree(&p); -- return false; -- } -+ } + -+ // FreeBSD wordexp bug workaround: -+ // 1. Reset SIGCHLD handler -+ // 2. Run wordexp -+ // 3. Restore SIGCHLD handler and reap any processes that exited -+ struct sigaction prev_action; -+ struct sigaction new_action = { -+ .sa_flags = SA_RESETHAND, -+ }; -+ if (sigaction(SIGCHLD, &new_action, &prev_action) != 0) { -+ sway_log(SWAY_ERROR, "Restoring sigchild before wordexp failed"); -+ return false; -+ } ++ // FreeBSD wordexp bug workaround: ++ // 1. Reset SIGCHLD handler ++ // 2. Run wordexp ++ // 3. Restore SIGCHLD handler and reap any processes that exited ++ struct sigaction prev_action; ++ struct sigaction new_action = { ++ .sa_flags = SA_RESETHAND, ++ }; ++ if (sigaction(SIGCHLD, &new_action, &prev_action) != 0) { ++ sway_log(SWAY_ERROR, "Restoring sigchild before wordexp failed"); ++ return false; ++ } + -+ int res = wordexp(*path, &p, 0); ++ int res = wordexp(*path, &p, 0); + -+ if (sigaction(SIGCHLD, &prev_action, NULL) != 0) { -+ sway_log(SWAY_ERROR, "Restoring sigchild after wordexp failed"); -+ } ++ if (sigaction(SIGCHLD, &prev_action, NULL) != 0) { ++ sway_log(SWAY_ERROR, "Restoring sigchild after wordexp failed"); ++ } + -+ int status; -+ int wres; -+ do { -+ wres = waitpid(-1, &status, WNOHANG); -+ } while (wres > 0 || (wres == -1 && errno == EINTR)); ++ int status; ++ int wres; ++ do { ++ wres = waitpid(-1, &status, WNOHANG); ++ } while (wres > 0 || (wres == -1 && errno == EINTR)); + -+ if (res != 0 || p.we_wordv[0] == NULL) { -+ wordfree(&p); -+ return false; -+ } - free(*path); - *path = join_args(p.we_wordv, p.we_wordc); - wordfree(&p); ++ if (res != 0 || p.we_wordv[0] == NULL) { + wordfree(&p); + return false; + } |
