aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd-string.c2
-rw-r--r--cmd.c3
2 files changed, 2 insertions, 3 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;
}
diff --git a/cmd.c b/cmd.c
index 10e25225..902c390f 100644
--- a/cmd.c
+++ b/cmd.c
@@ -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));
}