mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	Sync OpenBSD patchset 559:
Use home from struct passwd if HOME is empty as well as if it is NULL, and fix a style nit. Both from Tiago Cunha.
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: cmd-string.c,v 1.26 2009-11-18 01:24:33 tcunha Exp $ */
 | 
			
		||||
/* $Id: cmd-string.c,v 1.27 2009-11-22 00:13:34 tcunha Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -332,7 +332,7 @@ cmd_string_expand_tilde(const char *s, size_t *p)
 | 
			
		||||
 | 
			
		||||
	home = NULL;
 | 
			
		||||
	if (cmd_string_getc(s, p) == '/') {
 | 
			
		||||
		if ((home = getenv("HOME")) == NULL) {
 | 
			
		||||
		if ((home = getenv("HOME")) == NULL || *home == '\0') {
 | 
			
		||||
			if ((pw = getpwuid(getuid())) != NULL)
 | 
			
		||||
				home = pw->pw_dir;
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										5
									
								
								cmd.c
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								cmd.c
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: cmd.c,v 1.131 2009-11-19 22:20:04 tcunha Exp $ */
 | 
			
		||||
/* $Id: cmd.c,v 1.132 2009-11-22 00:13:34 tcunha Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -277,9 +277,8 @@ cmd_free(struct cmd *cmd)
 | 
			
		||||
size_t
 | 
			
		||||
cmd_print(struct cmd *cmd, char *buf, size_t len)
 | 
			
		||||
{
 | 
			
		||||
	if (cmd->entry->print == NULL) {
 | 
			
		||||
	if (cmd->entry->print == NULL)
 | 
			
		||||
		return (xsnprintf(buf, len, "%s", cmd->entry->name));
 | 
			
		||||
	}
 | 
			
		||||
	return (cmd->entry->print(cmd, buf, len));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user