a2f5020
diff -up ksh-20120801/src/cmd/ksh93/include/defs.h.longer ksh-20120801/src/cmd/ksh93/include/defs.h
a2f5020
--- ksh-20120801/src/cmd/ksh93/include/defs.h.longer	2012-06-25 20:47:47.000000000 +0200
ebf9b31
+++ ksh-20120801/src/cmd/ksh93/include/defs.h	2013-07-08 17:33:42.238534376 +0200
a2f5020
@@ -162,8 +162,8 @@ struct shared
a2f5020
 	Namval_t	*prev_table;	/* previous table used in nv_open  */ \
a2f5020
 	Sfio_t		*outpool;	/* ouput stream pool */ \
a2f5020
 	long		timeout;	/* read timeout */ \
a2f5020
-	short		curenv;		/* current subshell number */ \
a2f5020
-	short		jobenv;		/* subshell number for jobs */ \
a2f5020
+	long		curenv;		/* current subshell number */ \
a2f5020
+	long		jobenv;		/* subshell number for jobs */ \
a2f5020
 	int		infd;		/* input file descriptor */ \
a2f5020
 	short		nextprompt;	/* next prompt is PS<nextprompt> */ \
a2f5020
 	short		poolfiles; \
a2f5020
diff -up ksh-20120801/src/cmd/ksh93/include/jobs.h.longer ksh-20120801/src/cmd/ksh93/include/jobs.h
a2f5020
--- ksh-20120801/src/cmd/ksh93/include/jobs.h.longer	2011-12-19 13:36:37.000000000 +0100
ebf9b31
+++ ksh-20120801/src/cmd/ksh93/include/jobs.h	2013-07-08 17:32:52.881124147 +0200
a2f5020
@@ -87,7 +87,7 @@ struct process
a2f5020
 	unsigned short	p_exit;		/* exit value or signal number */
a2f5020
 	unsigned short	p_exitmin;	/* minimum exit value for xargs */
a2f5020
 	unsigned short	p_flag;		/* flags - see below */
a2f5020
-	int		p_env;		/* subshell environment number */
a2f5020
+	long		p_env;		/* subshell environment number */
a2f5020
 #ifdef JOBS
a2f5020
 	off_t		p_name;		/* history file offset for command */
a2f5020
 	struct termios	p_stty;		/* terminal state for job */
ebf9b31
diff -up ksh-20120801/src/cmd/ksh93/sh/jobs.c.longer ksh-20120801/src/cmd/ksh93/sh/jobs.c
a2f5020
diff -up ksh-20120801/src/cmd/ksh93/sh/subshell.c.longer ksh-20120801/src/cmd/ksh93/sh/subshell.c
ebf9b31
--- ksh-20120801/src/cmd/ksh93/sh/subshell.c.longer	2013-07-08 17:32:52.874124090 +0200
ebf9b31
+++ ksh-20120801/src/cmd/ksh93/sh/subshell.c	2013-07-08 17:32:52.882124156 +0200
a2f5020
@@ -98,7 +98,7 @@ static struct subshell
a2f5020
 #endif /* SHOPT_COSHELL */
a2f5020
 } *subshell_data;
a2f5020
 
a2f5020
-static int subenv;
a2f5020
+static long subenv;
a2f5020
 
a2f5020
 
a2f5020
 /*
ebf9b31
@@ -171,7 +171,8 @@ void sh_subfork(void)
a2f5020
 {
a2f5020
 	register struct subshell *sp = subshell_data;
a2f5020
 	Shell_t	*shp = sp->shp;
ebf9b31
-	int	curenv = shp->curenv, comsub=shp->comsub;
ebf9b31
+	long	curenv = shp->curenv;
ebf9b31
+	int	comsub=shp->comsub;
a2f5020
 	pid_t pid;
a2f5020
 	char *trap = shp->st.trapcom[0];
a2f5020
 	if(trap)
ebf9b31
@@ -461,7 +462,7 @@ Sfio_t *sh_subshell(Shell_t *shp,Shnode_
a2f5020
 	struct subshell sub_data;
a2f5020
 	register struct subshell *sp = &sub_data;
a2f5020
 	int jmpval,nsig=0,duped=0;
a2f5020
-	int savecurenv = shp->curenv;
a2f5020
+	long savecurenv = shp->curenv;
a2f5020
 	int savejobpgid = job.curpgid;
a2f5020
 	int *saveexitval = job.exitval;
a2f5020
 	int16_t subshell;