mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	Merge branch 'master' of github.com:SirCmpwn/sway
This commit is contained in:
		
						commit
						1011957465
					
				
					 1 changed files with 7 additions and 6 deletions
				
			
		
							
								
								
									
										13
									
								
								sway/ipc.c
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								sway/ipc.c
									
										
									
									
									
								
							| 
						 | 
					@ -94,14 +94,15 @@ struct sockaddr_un *ipc_user_sockaddr(void) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ipc_sockaddr->sun_family = AF_UNIX;
 | 
						ipc_sockaddr->sun_family = AF_UNIX;
 | 
				
			||||||
 | 
					 | 
				
			||||||
	int path_size = sizeof(ipc_sockaddr->sun_path);
 | 
						int path_size = sizeof(ipc_sockaddr->sun_path);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Without logind:
 | 
						// Env var typically set by logind, e.g. "/run/user/<user-id>"
 | 
				
			||||||
	int allocating_path_size = snprintf(ipc_sockaddr->sun_path, path_size,
 | 
						const char *dir = getenv("XDG_RUNTIME_DIR");
 | 
				
			||||||
			"/tmp/sway-ipc.%i.%i.sock", getuid(), getpid());
 | 
						if (!dir) {
 | 
				
			||||||
 | 
							dir = "/tmp";
 | 
				
			||||||
	if (allocating_path_size >= path_size) {
 | 
						}
 | 
				
			||||||
 | 
						if (path_size <= snprintf(ipc_sockaddr->sun_path, path_size,
 | 
				
			||||||
 | 
								"%s/sway-ipc.%i.%i.sock", dir, getuid(), getpid())) {
 | 
				
			||||||
		sway_abort("socket path won't fit into ipc_sockaddr->sun_path");
 | 
							sway_abort("socket path won't fit into ipc_sockaddr->sun_path");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue