mirror of
				git://git.code.sf.net/p/cdesktopenv/code
				synced 2025-03-09 15:50:02 +00:00 
			
		
		
		
	sh_subsavefd(): avoid a negative shift operand
This change is backported from the abandoned ksh 93v- beta. src/cmd/ksh93/sh/subshell.c: sh_subsavefd(): - Do not subtract 1 from fd, as this would cause a negative shift operand for stdin (fd==0).
This commit is contained in:
		
							parent
							
								
									ba6fc164d7
								
							
						
					
					
						commit
						de7eb85255
					
				
					 1 changed files with 3 additions and 3 deletions
				
			
		|  | @ -90,7 +90,7 @@ static struct subshell | |||
| 	char		jobcontrol; | ||||
| 	char		monitor; | ||||
| 	unsigned char	fdstatus; | ||||
| 	int		fdsaved; /* bit make for saved files */ | ||||
| 	int		fdsaved; /* bit mask for saved file descriptors */ | ||||
| 	int		sig;	/* signal for $$ */ | ||||
| 	pid_t		bckpid; | ||||
| 	pid_t		cpid; | ||||
|  | @ -457,8 +457,8 @@ int sh_subsavefd(register int fd) | |||
| 	register int old=0; | ||||
| 	if(sp) | ||||
| 	{ | ||||
| 		old = !(sp->fdsaved&(1<<(fd-1))); | ||||
| 		sp->fdsaved |= (1<<(fd-1)); | ||||
| 		old = !(sp->fdsaved&(1<<fd)); | ||||
| 		sp->fdsaved |= (1<<fd); | ||||
| 	} | ||||
| 	return(old); | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue