mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	set IPC client sockets to close on exec
This commit is contained in:
		
							parent
							
								
									91c0877264
								
							
						
					
					
						commit
						70f046c87a
					
				
					 1 changed files with 7 additions and 0 deletions
				
			
		| 
						 | 
					@ -10,6 +10,7 @@
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include <stdlib.h>
 | 
				
			||||||
#include <stropts.h>
 | 
					#include <stropts.h>
 | 
				
			||||||
#include <sys/ioctl.h>
 | 
					#include <sys/ioctl.h>
 | 
				
			||||||
 | 
					#include <fcntl.h>
 | 
				
			||||||
#include "ipc.h"
 | 
					#include "ipc.h"
 | 
				
			||||||
#include "log.h"
 | 
					#include "log.h"
 | 
				
			||||||
#include "config.h"
 | 
					#include "config.h"
 | 
				
			||||||
| 
						 | 
					@ -78,6 +79,12 @@ int ipc_handle_connection(int fd, uint32_t mask, void *data) {
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						int flags;
 | 
				
			||||||
 | 
						if ((flags=fcntl(client_fd, F_GETFD)) == -1 || fcntl(client_fd, F_SETFD, flags|FD_CLOEXEC) == -1) {
 | 
				
			||||||
 | 
							sway_log_errno(L_INFO, "Unable to set CLOEXEC on IPC client socket");
 | 
				
			||||||
 | 
							return 0;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct ipc_client* client = malloc(sizeof(struct ipc_client));
 | 
						struct ipc_client* client = malloc(sizeof(struct ipc_client));
 | 
				
			||||||
	client->payload_length = 0;
 | 
						client->payload_length = 0;
 | 
				
			||||||
	client->fd = client_fd;
 | 
						client->fd = client_fd;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue