summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-11-21 17:52:19 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-11-21 17:52:19 +0000
commit8647edfb6c950d5a05866d7b141b8524000760d7 (patch)
treeb4938f2c6f49e7d81be7844bf14cf7145b66e961
parent7cfcf0ca0523919e75210dd5d90ebc250a452d70 (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.
-rw-r--r--usr.bin/tmux/cmd-string.c4
-rw-r--r--usr.bin/tmux/cmd.c5
2 files changed, 4 insertions, 5 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;
}
diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c
index c121d173614..2fd5eb0029a 100644
--- a/usr.bin/tmux/cmd.c
+++ b/usr.bin/tmux/cmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd.c,v 1.32 2009/11/18 13:16:33 nicm Exp $ */
+/* $OpenBSD: cmd.c,v 1.33 2009/11/21 17:52:18 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -278,9 +278,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));
}