Blame SOURCES/ksh-20120801-F_dupfd_cloexec.patch

61d8f4
diff -up ksh-20120801/src/cmd/ksh93/sh/io.c.orig ksh-20120801/src/cmd/ksh93/sh/io.c
61d8f4
--- ksh-20120801/src/cmd/ksh93/sh/io.c.orig	2015-08-12 11:35:36.882268954 -0300
61d8f4
+++ ksh-20120801/src/cmd/ksh93/sh/io.c	2015-08-12 11:44:06.324587019 -0300
61d8f4
@@ -2580,10 +2580,18 @@ int sh_fcntl(register int fd, int op, ..
61d8f4
 	if(newfd>=0) switch(op)
61d8f4
 	{
61d8f4
 	    case F_DUPFD:
61d8f4
+#if F_dupfd_cloexec != F_DUPFD
61d8f4
+	    case F_dupfd_cloexec:
61d8f4
+#endif
61d8f4
 		if(shp->fdstatus[fd] == IOCLOSE)
61d8f4
 			shp->fdstatus[fd] = 0;
61d8f4
 		if(newfd>=shp->gd->lim.open_max)
61d8f4
 			sh_iovalidfd(shp,newfd);
61d8f4
+#if F_dupfd_cloexec != F_DUPFD
61d8f4
+		if(op==F_dupfd_cloexec)
61d8f4
+			shp->fdstatus[newfd] = (shp->fdstatus[fd]|IOCLEX);
61d8f4
+		else
61d8f4
+#endif
61d8f4
 		shp->fdstatus[newfd] = (shp->fdstatus[fd]&~IOCLEX);
61d8f4
 		if(fdnotify)
61d8f4
 			(*fdnotify)(fd,newfd);