--- ./main.c.origin	2023-10-16 07:12:32.041748801 +0000
+++ ./main.c	2023-10-16 07:13:41.071096888 +0000
@@ -335,6 +335,9 @@
         // Detach us from the current TTY
         setsid();
 
+	slavept=open(name, O_RDWR );
+
+#ifdef TIOCSCTTY
         // Attach the process to a controlling TTY.
         slavept=open(name, O_RDWR | O_NOCTTY);
         // On some systems, an open(2) is insufficient to set the controlling tty (see the documentation for
@@ -343,6 +346,7 @@
             perror("sshpass: Failed to set controlling terminal in child (TIOCSCTTY)");
             exit(RETURN_RUNTIME_ERROR);
         }
+#endif
         close( slavept ); // We don't need the controlling TTY actually open
 
         close( masterpt );
