Set FDs CLOEXEC
This commit is contained in:
		
							parent
							
								
									9b9794df33
								
							
						
					
					
						commit
						362d779b61
					
				
							
								
								
									
										5
									
								
								chat.c
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								chat.c
									
									
									
									
									
								
							@ -16,6 +16,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <err.h>
 | 
					#include <err.h>
 | 
				
			||||||
#include <errno.h>
 | 
					#include <errno.h>
 | 
				
			||||||
 | 
					#include <fcntl.h>
 | 
				
			||||||
#include <locale.h>
 | 
					#include <locale.h>
 | 
				
			||||||
#include <poll.h>
 | 
					#include <poll.h>
 | 
				
			||||||
#include <signal.h>
 | 
					#include <signal.h>
 | 
				
			||||||
@ -164,6 +165,10 @@ int main(int argc, char *argv[]) {
 | 
				
			|||||||
	int error = pipe(procPipe);
 | 
						int error = pipe(procPipe);
 | 
				
			||||||
	if (error) err(EX_OSERR, "pipe");
 | 
						if (error) err(EX_OSERR, "pipe");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						fcntl(irc, F_SETFD, FD_CLOEXEC);
 | 
				
			||||||
 | 
						fcntl(procPipe[0], F_SETFD, FD_CLOEXEC);
 | 
				
			||||||
 | 
						fcntl(procPipe[1], F_SETFD, FD_CLOEXEC);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct pollfd fds[3] = {
 | 
						struct pollfd fds[3] = {
 | 
				
			||||||
		{ .events = POLLIN, .fd = STDIN_FILENO },
 | 
							{ .events = POLLIN, .fd = STDIN_FILENO },
 | 
				
			||||||
		{ .events = POLLIN, .fd = irc },
 | 
							{ .events = POLLIN, .fd = irc },
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user