diff options
author | 2009-11-21 17:52:18 +0000 | |
---|---|---|
committer | 2009-11-21 17:52:18 +0000 | |
commit | e54a8d16631893b00c0147a319e1ca814abfe3a1 (patch) | |
tree | b18f6cd5686cbc1b8ea47beadeb783bf52bfe95d /usr.bin/tmux/cmd-string.c | |
parent | replacing malloc/realloc dance, by only one realloc (diff) | |
download | wireguard-openbsd-e54a8d16631893b00c0147a319e1ca814abfe3a1.tar.xz wireguard-openbsd-e54a8d16631893b00c0147a319e1ca814abfe3a1.zip |
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 'usr.bin/tmux/cmd-string.c')
-rw-r--r-- | usr.bin/tmux/cmd-string.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/tmux/cmd-string.c b/usr.bin/tmux/cmd-string.c index f18d97f5d32..6a5a0479e5e 100644 --- a/usr.bin/tmux/cmd-string.c +++ b/usr.bin/tmux/cmd-string.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-string.c,v 1.9 2009/11/16 11:15:44 nicm Exp $ */ +/* $OpenBSD: cmd-string.c,v 1.10 2009/11/21 17:52:18 nicm 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; } |