aboutsummaryrefslogtreecommitdiffstats
path: root/testing/kitty/fix-ppc64le-build-ioctl-with-musl.patch
blob: 6e925b33894ff139bd4909fe0980144a6960b4b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
kitty was breaking when building in ppc64le using musl, because ioctl() is defined
as ioctl(int, int) in musl and mosh is using TIOCSWINSZ macro as parameter. This was
triggering a gcc warning and make the build fail.

This patch does an explicit integer conversion in TIOCSWINSZ, as no bits get
lost.


--- a/kitty/child-monitor.c
+++ b/kitty/child-monitor.c
@@ -435,7 +435,11 @@
 static inline bool
 pty_resize(int fd, struct winsize *dim) {
     while(true) {
+#if defined(__powerpc64__) && (!defined(__GLIBC__) && !defined(__UCLIBC__))
+        if (ioctl(fd, (int) TIOCSWINSZ, dim) == -1) {
+#else
         if (ioctl(fd, TIOCSWINSZ, dim) == -1) {
+#endif
             if (errno == EINTR) continue;
             if (errno != EBADF && errno != ENOTTY) {
                 log_error("Failed to resize tty associated with fd: %d with error: %s", fd, strerror(errno));