summaryrefslogtreecommitdiffstats
path: root/cmd-string.c
authortcunha <tcunha>2009-11-22 00:13:34 (GMT)
committer tcunha <tcunha>2009-11-22 00:13:34 (GMT)
commit367e0776c9a7dcec453c670dcac8b37e6821c268 (patch) (side-by-side diff)
tree838a3c9c9ffdcdd38c2c7ad8d0c0d7e55ce18f4e /cmd-string.c
parent3dec25f642a120fb9b1866ff45ac380638de1d45 (diff)
downloadtmux-old-367e0776c9a7dcec453c670dcac8b37e6821c268.zip
tmux-old-367e0776c9a7dcec453c670dcac8b37e6821c268.tar.gz
tmux-old-367e0776c9a7dcec453c670dcac8b37e6821c268.tar.bz2
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.
Diffstat (limited to 'cmd-string.c') (more/less context) (ignore whitespace changes)
-rw-r--r--cmd-string.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd-string.c b/cmd-string.c
index e729fe5..5c000e1 100644
--- a/cmd-string.c
+++ b/cmd-string.c
@@ -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 <[email protected]>
@@ -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;
}