improving shell detection
This commit is contained in:
		
							parent
							
								
									5610a384b8
								
							
						
					
					
						commit
						af11439bd5
					
				
							
								
								
									
										12
									
								
								termite.cc
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								termite.cc
									
									
									
									
									
								
							@ -1480,11 +1480,17 @@ static void exit_with_success(VteTerminal *) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static char *get_user_shell_with_fallback() {
 | 
					static char *get_user_shell_with_fallback() {
 | 
				
			||||||
    if (const char *env = g_getenv("SHELL"))
 | 
					    if (const char *env = g_getenv("SHELL") )
 | 
				
			||||||
        return g_strdup(env);
 | 
					    {
 | 
				
			||||||
 | 
					        if (!((env != NULL) && (env[0] == '\0')))
 | 
				
			||||||
 | 
					            return g_strdup(env);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (char *command = vte_get_user_shell())
 | 
					    if (char *command = vte_get_user_shell())
 | 
				
			||||||
        return command;
 | 
					    {
 | 
				
			||||||
 | 
					        if (!((command != NULL) && (command[0] == '\0')))
 | 
				
			||||||
 | 
					           return command;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return g_strdup("/bin/sh");
 | 
					    return g_strdup("/bin/sh");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user