aboutsummaryrefslogtreecommitdiff
path: root/tests/unittests/torture_misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unittests/torture_misc.c')
-rw-r--r--tests/unittests/torture_misc.c12
1 files changed, 11 insertions, 1 deletions
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 <unistd.h>
+#endif
#include <sys/types.h>
#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);