components/ksh93/patches/120-CR7089799.patch
author Mike Sullivan <Mike.Sullivan@Oracle.COM>
Mon, 18 May 2015 14:11:16 -0700
changeset 4305 90493abe0c5c
parent 4268 d723f8ed85fe
child 5129 5431772f7235
permissions -rw-r--r--
backout 17533968/17817727/17699248/17777549/18119738/18229654/16169978/18302723/16507675/18920300/18355790/19907453/18426052/20808157/20948390/20948350 - causes 21091065

diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/io.c INIT.2011-02-08/src/cmd/ksh93/sh/io.c
--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/io.c	2012-05-07 14:33:37.179788579 +0100
+++ INIT.2011-02-08/src/cmd/ksh93/sh/io.c	2012-05-07 14:39:11.089877123 +0100
@@ -868,10 +868,10 @@ int sh_iomovefd(register int fdold)
 {
 	Shell_t *shp = sh_getinterp();
 	register int fdnew;
+	VALIDATE_FD(shp, fdold);
 	if(fdold<0 || fdold>2)
 		return(fdold);
 	fdnew = sh_iomovefd(dup(fdold));
-	VALIDATE_FD(shp, fdold);
 	VALIDATE_FD(shp, fdnew);
 	shp->fdstatus[fdnew] = (shp->fdstatus[fdold]&~IOCLEX);
 	close(fdold);
@@ -890,6 +890,8 @@ int	sh_pipe(register int pv[])
 		errormsg(SH_DICT,ERROR_system(1),e_pipe);
 	pv[0] = sh_iomovefd(pv[0]);
 	pv[1] = sh_iomovefd(pv[1]);
+	VALIDATE_FD(shp, pv[0]);
+	VALIDATE_FD(shp, pv[1]);
 	shp->fdstatus[pv[0]] = IONOSEEK|IOREAD;
 	shp->fdstatus[pv[1]] = IONOSEEK|IOWRITE;
 	sh_subsavefd(pv[0]);
diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/path.c INIT.2011-02-08/src/cmd/ksh93/sh/path.c
--- INIT.2011-02-08.clean/src/cmd/ksh93/sh/path.c	2012-05-07 14:33:37.182443770 +0100
+++ INIT.2011-02-08/src/cmd/ksh93/sh/path.c	2012-05-07 14:40:06.256096054 +0100
@@ -565,6 +565,7 @@ static int	path_opentype(Shell_t *shp,co
 	if(fd>=0 && (fd = sh_iomovefd(fd)) > 0)
 	{
 		fcntl(fd,F_SETFD,FD_CLOEXEC);
+		VALIDATE_FD(shp, fd);
 		shp->fdstatus[fd] |= IOCLEX;
 	}
 	return(fd);