libutil: add O_NOCTTY back to old pty open code
restores fix 4f78dfcabc1500bef891039d3bcb73253468339a . fixes e.g. ssh sessions not getting their own controlling tty
This commit is contained in:
		
							parent
							
								
									11184894e2
								
							
						
					
					
						commit
						59ba14bb1d
					
				@ -105,7 +105,7 @@ openpty(int *amaster, int *aslave, char *name, struct termios *term,
 | 
				
			|||||||
		for (cp = cp2 = TTY_OLD_SUFFIX TTY_NEW_SUFFIX; *cp2; cp2++) {
 | 
							for (cp = cp2 = TTY_OLD_SUFFIX TTY_NEW_SUFFIX; *cp2; cp2++) {
 | 
				
			||||||
			line[5] = 'p';
 | 
								line[5] = 'p';
 | 
				
			||||||
			line[9] = *cp2;
 | 
								line[9] = *cp2;
 | 
				
			||||||
			if ((master = open(line, O_RDWR, 0)) == -1) {
 | 
								if ((master = open(line, O_RDWR | O_NOCTTY, 0)) == -1) {
 | 
				
			||||||
				if (errno != ENOENT)
 | 
									if (errno != ENOENT)
 | 
				
			||||||
					continue;	/* busy */
 | 
										continue;	/* busy */
 | 
				
			||||||
				if ((size_t)(cp2 - cp + 1) < sizeof(TTY_OLD_SUFFIX))
 | 
									if ((size_t)(cp2 - cp + 1) < sizeof(TTY_OLD_SUFFIX))
 | 
				
			||||||
@ -120,7 +120,7 @@ openpty(int *amaster, int *aslave, char *name, struct termios *term,
 | 
				
			|||||||
#ifndef __minix
 | 
					#ifndef __minix
 | 
				
			||||||
			    revoke(line) == 0 &&
 | 
								    revoke(line) == 0 &&
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
			    (slave = open(line, O_RDWR, 0)) != -1) {
 | 
								    (slave = open(line, O_RDWR | O_NOCTTY, 0)) != -1) {
 | 
				
			||||||
#ifndef __minix
 | 
					#ifndef __minix
 | 
				
			||||||
gotit:
 | 
					gotit:
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user