mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	Abort early when XDG_RUNTIME_DIR is not set
This aborts sway and displays an error message about XDG_RUNTIME_DIR not being set without initializing the wl_display or logging any other information.
This commit is contained in:
		
							parent
							
								
									d2c896ed84
								
							
						
					
					
						commit
						2540e8ea79
					
				
					 1 changed files with 8 additions and 0 deletions
				
			
		| 
						 | 
					@ -299,6 +299,14 @@ int main(int argc, char **argv) {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Since wayland requires XDG_RUNTIME_DIR to be set, abort with just the
 | 
				
			||||||
 | 
						// clear error message (when not running as an IPC client).
 | 
				
			||||||
 | 
						if (!getenv("XDG_RUNTIME_DIR") && optind == argc) {
 | 
				
			||||||
 | 
							fprintf(stderr,
 | 
				
			||||||
 | 
									"XDG_RUNTIME_DIR is not set in the environment. Aborting.\n");
 | 
				
			||||||
 | 
							exit(EXIT_FAILURE);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// As the 'callback' function for wlr_log is equivalent to that for
 | 
						// As the 'callback' function for wlr_log is equivalent to that for
 | 
				
			||||||
	// sway, we do not need to override it.
 | 
						// sway, we do not need to override it.
 | 
				
			||||||
	if (debug) {
 | 
						if (debug) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue