summaryrefslogtreecommitdiffstats
path: root/cmd-string.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-11-21 17:52:18 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-11-21 17:52:18 +0000
commit9b9d26f80e2057488c1a8fe93dc729fdf6a9e9be (patch)
tree8f4e1a037f55be6ac14e31fd6946360ea00298fa /cmd-string.c
parent58688c48aa78173406c4037a6e8c0591ca3af591 (diff)
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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/cmd-string.c b/cmd-string.c
index 1a380e50..9cb48466 100644
--- a/cmd-string.c
+++ b/cmd-string.c
@@ -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;
}