path: root/testing/kitty/fix-ppc64le-build-ioctl-with-musl.patch
blob: 6e925b33894ff139bd4909fe0980144a6960b4b5 (plain) (tree)

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

--- 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) {
         if (ioctl(fd, TIOCSWINSZ, dim) == -1) {
             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));