aboutsummaryrefslogtreecommitdiff
path: root/libssh/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'libssh/misc.c')
-rw-r--r--libssh/misc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libssh/misc.c b/libssh/misc.c
index 7e842770..14b155c3 100644
--- a/libssh/misc.c
+++ b/libssh/misc.c
@@ -129,9 +129,11 @@ char *ssh_get_user_home_dir(void) {
rc = getpwuid_r(getuid(), &pwd, buf, NSS_BUFLEN_PASSWD, &pwdbuf);
if (rc != 0) {
- return NULL;
+ szPath = getenv("HOME");
+ return szPath ? strdup(szPath) : NULL;
}
+
szPath = strdup(pwd.pw_dir);
return szPath;