--- a/open-src/app/xterm/Makefile Wed Mar 16 11:26:48 2016 -0700
+++ b/open-src/app/xterm/Makefile Fri Mar 18 18:23:26 2016 -0700
@@ -70,6 +70,7 @@
# Patches to apply to source after unpacking, in order
SOURCE_PATCHES = desktop-icon.patch,-p1
SOURCE_PATCHES += solaris-ia.patch,-p1
+SOURCE_PATCHES += xpg-open.patch,-p1
# Man pages to apply Sun footer to & attributes to list
SUNTOUCHED_MANPAGES=koi8rxterm.man resize.man uxterm.man xterm.man
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/app/xterm/xpg-open.patch Fri Mar 18 18:23:26 2016 -0700
@@ -0,0 +1,30 @@
+diff --git a/main.c b/main.c
+index 95bd7cb..5418e97 100644
+--- a/main.c
++++ b/main.c
+@@ -3731,7 +3731,8 @@ spawnXTerm(XtermWidget xw)
+ SysError(ERROR_OPPTSNAME);
+ }
+ #ifdef I_PUSH
+- else if (ioctl(ptyfd, I_PUSH, "ptem") < 0) {
++ else if ((ioctl(ptyfd, I_FIND, "ptem") == 0) &&
++ (ioctl(ptyfd, I_PUSH, "ptem") < 0)) {
+ SysError(ERROR_PTEM);
+ }
+ #if !defined(SVR4) && !(defined(SYSV) && defined(i386))
+@@ -3740,11 +3741,13 @@ spawnXTerm(XtermWidget xw)
+ SysError(ERROR_CONSEM);
+ }
+ #endif /* !SVR4 */
+- else if (ioctl(ptyfd, I_PUSH, "ldterm") < 0) {
++ else if ((ioctl(ptyfd, I_FIND, "ldterm") == 0) &&
++ (ioctl(ptyfd, I_PUSH, "ldterm") < 0)) {
+ SysError(ERROR_LDTERM);
+ }
+ #ifdef SVR4 /* from Sony */
+- else if (ioctl(ptyfd, I_PUSH, "ttcompat") < 0) {
++ else if ((ioctl(ptyfd, I_FIND, "ttcompat") == 0) &&
++ (ioctl(ptyfd, I_PUSH, "ttcompat") < 0)) {
+ SysError(ERROR_TTCOMPAT);
+ }
+ #endif /* SVR4 */