mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Just nuke environ instead of trying to unsetenv everything because that
doesn't necessarily work if there is an entry with an empty name.
This commit is contained in:
		
							
								
								
									
										14
									
								
								environ.c
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								environ.c
									
									
									
									
									
								
							@@ -195,19 +195,11 @@ environ_update(const char *vars, struct environ *srcenv,
 | 
			
		||||
void
 | 
			
		||||
environ_push(struct environ *env)
 | 
			
		||||
{
 | 
			
		||||
	struct environ_entry	 *envent;
 | 
			
		||||
	char			*v;
 | 
			
		||||
 | 
			
		||||
	while (*environ != NULL) {
 | 
			
		||||
		v = xstrdup(*environ);
 | 
			
		||||
		v[strcspn(v, "=")] = '\0';
 | 
			
		||||
 | 
			
		||||
		unsetenv(v);
 | 
			
		||||
		free(v);
 | 
			
		||||
	}
 | 
			
		||||
	struct environ_entry	*envent;
 | 
			
		||||
 | 
			
		||||
	environ = xcalloc(1, sizeof *environ);
 | 
			
		||||
	RB_FOREACH(envent, environ, env) {
 | 
			
		||||
		if (envent->value != NULL)
 | 
			
		||||
		if (envent->value != NULL && *envent->name != '\0')
 | 
			
		||||
			setenv(envent->name, envent->value, 1);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user