ports/irc/scrollz/files/patch-source-screen.c
Chris Petrik c4a3720505 irc/scrollz: Update to version 2.3.1
ChangeLog: https://www.scrollz.info/download/ChangeLog.2.3.1.txt

Use online commit to avoid gcc.

PR:	262693
Reported by:	Christopher.petrik@usm.edu
Approved by:	freebsd@bitchx.org (maintainer, timeout > 2 weeks)
Reviewed by:	mikael@
MFH:	2022Q2 (bugfix release, security)
Security:	CVE-2021-29376
2022-04-12 12:05:26 +02:00

44 lines
1.3 KiB
C

--- source/screen.c.orig 2021-05-06 08:04:55 UTC
+++ source/screen.c
@@ -2425,6 +2425,10 @@ create_additional_screen()
{
screen_type = ST_SCREEN;
}
+ else if (0 != getenv("TMUX"))
+ {
+ screen_type = ST_TMUX;
+ }
else if ((char *) 0 != (displayvar = getenv("DISPLAY")))
{
if ((char *) 0 == (termvar = getenv("TERM")))
@@ -2463,6 +2467,7 @@ create_additional_screen()
say("Opening new %s...",
screen_type == ST_XTERM ? "window" :
screen_type == ST_SCREEN ? "screen" :
+ screen_type == ST_TMUX ? "tmux window" :
"wound" );
snprintf(sock.sun_path, sizeof sock.sun_path, "/tmp/irc_%08d_%x", (int) pid, mycycle);
sock.sun_family = AF_UNIX;
@@ -2577,6 +2582,22 @@ create_additional_screen()
args[i++] = error_sockaddr->sun_path;
args[i] = NULL;
execvp(xterm, args);
+ }
+ else if (screen_type == ST_TMUX)
+ {
+ char *args[64],
+ *ss,
+ *t,
+ opts[BIG_BUFFER_SIZE];
+
+ Debug((3, "going to execvp screen wserv..."));
+ args[i++] = "tmux";
+ args[i++] = "new-window";
+ snprintf(opts, BIG_BUFFER_SIZE-1, "%s %s %s", WSERV_PATH, sockaddr->sun_path, error_sockaddr->sun_path);
+ args[i++] = opts;
+ Debug((3, "added: %s %s '%s'", args[i-3], args[i-2], args[i-1]));
+ args[i++] = NULL;
+ execvp("tmux", args);
}
perror("execve");
unlink(sockaddr->sun_path);