diff --git a/tests/unittests/torture_misc.c b/tests/unittests/torture_misc.c index de84c4a3..37fa4aed 100644 --- a/tests/unittests/torture_misc.c +++ b/tests/unittests/torture_misc.c @@ -1,5 +1,8 @@ #include "config.h" +#ifdef HAVE_UNISTD_H +#include +#endif #include #ifndef _WIN32 @@ -129,7 +132,14 @@ static void torture_path_expand_tilde_unix(void **state) { if (user == NULL){ user = getenv("LOGNAME"); } - assert_non_null(user); + /* in certain CIs there no such variables */ + if (!user){ + struct passwd *pw = getpwuid(getuid()); + if (pw){ + user = pw->pw_name; + } + } + home = getenv("HOME"); assert_non_null(home); snprintf(h, 256 - 1, "%s/.ssh", home);