mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-08-05 20:55:46 +03:00
tests: Fixed torture_get_user_home_dir on Windows.
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#ifndef _WIN32
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define LIBSSH_STATIC
|
#define LIBSSH_STATIC
|
||||||
#include <libssh/priv.h>
|
#include <libssh/priv.h>
|
||||||
@@ -19,15 +21,18 @@ static void teardown(void **state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void torture_get_user_home_dir(void **state) {
|
static void torture_get_user_home_dir(void **state) {
|
||||||
struct passwd *pwd;
|
#ifndef _WIN32
|
||||||
|
struct passwd *pwd = getpwuid(getuid());
|
||||||
|
#endif /* _WIN32 */
|
||||||
char *user;
|
char *user;
|
||||||
|
|
||||||
(void) state;
|
(void) state;
|
||||||
|
|
||||||
pwd = getpwuid(getuid());
|
|
||||||
|
|
||||||
user = ssh_get_user_home_dir();
|
user = ssh_get_user_home_dir();
|
||||||
|
assert_false(user == NULL);
|
||||||
|
#ifndef _WIN32
|
||||||
assert_string_equal(user, pwd->pw_dir);
|
assert_string_equal(user, pwd->pw_dir);
|
||||||
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
SAFE_FREE(user);
|
SAFE_FREE(user);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user