aboutsummaryrefslogtreecommitdiff
path: root/cmd-string.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-11-22 00:13:34 +0000
committerTiago Cunha <tcunha@gmx.com>2009-11-22 00:13:34 +0000
commit1a41a3b48fe301b994b723aec569dd3a7083c5a5 (patch)
tree4f96d95ca7d1abda375c05cede88a18193b64a3d /cmd-string.c
parent1527ed0ff8ca9da9d297a644ca23bda87b9ffdac (diff)
downloadrtmux-1a41a3b48fe301b994b723aec569dd3a7083c5a5.tar.gz
rtmux-1a41a3b48fe301b994b723aec569dd3a7083c5a5.tar.bz2
rtmux-1a41a3b48fe301b994b723aec569dd3a7083c5a5.zip
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')
-rw-r--r--cmd-string.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd-string.c b/cmd-string.c
index 2ca21983..dfcc13d6 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 <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;
}