Skip to content

Commit

Permalink
tinyx: fix SIGINT handling in st and xserver
Browse files Browse the repository at this point in the history
Pressing ^C in X session is now captured by client apps instead of
killing the X server. Pressing ^C in st sends SIGINT to the process
inside pty instead of doing nothing.

JIRA: RTOS-861, RTOS-889
  • Loading branch information
adamgreloch committed Sep 2, 2024
1 parent 052aa3e commit c07b378
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tinyx/patches/st/0.2/04-tiocstty.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff -ruN a/st.c b/st.c
--- a/st.c 2024-09-02 10:01:36.967676919 +0200
+++ b/st.c 2024-09-02 11:46:12.263350519 +0200
@@ -708,6 +709,8 @@
dup2(s, STDIN_FILENO);
dup2(s, STDOUT_FILENO);
dup2(s, STDERR_FILENO);
+ if(ioctl(s, TIOCSCTTY, NULL) < 0)
+ die("ioctl TIOCSCTTY failed: %s\n", SERRNO);
close(s);
close(m);
execsh();
29 changes: 29 additions & 0 deletions tinyx/patches/tinyx/eed490/13-tiocnotty.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
diff -ruN a/kdrive/phoenix/phoenix.c b/kdrive/phoenix/phoenix.c
--- a/kdrive/phoenix/phoenix.c 2024-09-02 10:24:29.020264244 +0200
+++ b/kdrive/phoenix/phoenix.c 2024-09-02 11:36:26.806165111 +0200
@@ -4,6 +4,7 @@
#include "kdrive.h"
#include <errno.h>
#include <signal.h>
+#include <termios.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <X11/keysym.h>
@@ -14,6 +15,17 @@

static int PhoenixInit(void)
{
+ int fd;
+ if ((fd = open("/dev/tty0", O_WRONLY, 0)) < 0) {
+ FatalError("PhoenixInit: Cannot open /dev/tty0 (%s)\n",
+ strerror(errno));
+ }
+
+ if (ioctl(fd, TIOCNOTTY, NULL) < 0) {
+ FatalError("PhoenixInit: TIOCNOTTY failed\n");
+ }
+ close(fd);
+
return 1;
}

0 comments on commit c07b378

Please sign in to comment.