File php-pts.patch of Package php7.30325

Index: ext/standard/proc_open.c
===================================================================
--- ext/standard/proc_open.c.orig
+++ ext/standard/proc_open.c
@@ -56,7 +56,7 @@
  * */
 #ifdef PHP_CAN_SUPPORT_PROC_OPEN
 
-#if 0 && HAVE_PTSNAME && HAVE_GRANTPT && HAVE_UNLOCKPT && HAVE_SYS_IOCTL_H && HAVE_TERMIOS_H
+#if HAVE_PTSNAME && HAVE_GRANTPT && HAVE_UNLOCKPT && HAVE_SYS_IOCTL_H && HAVE_TERMIOS_H
 # include <sys/ioctl.h>
 # include <termios.h>
 # define PHP_CAN_DO_PTS	1
@@ -636,14 +636,18 @@ PHP_FUNCTION(proc_open)
 #if PHP_CAN_DO_PTS
 				if (dev_ptmx == -1) {
 					/* open things up */
-					dev_ptmx = open("/dev/ptmx", O_RDWR);
+					dev_ptmx = open("/dev/ptmx", O_RDWR|O_NOCTTY);
 					if (dev_ptmx == -1) {
 						php_error_docref(NULL, E_WARNING, "failed to open /dev/ptmx, errno %d", errno);
 						goto exit_fail;
 					}
 					grantpt(dev_ptmx);
 					unlockpt(dev_ptmx);
+#ifdef TIOCGPTPEER
+					slave_pty = ioctl(dev_ptmx, TIOCGPTPEER, O_RDWR);
+#else
 					slave_pty = open(ptsname(dev_ptmx), O_RDWR);
+#endif
 
 					if (slave_pty == -1) {
 						php_error_docref(NULL, E_WARNING, "failed to open slave pty, errno %d", errno);
openSUSE Build Service is sponsored by