Skip to content
Snippets Groups Projects
Commit b969101b authored by Matt Johnston's avatar Matt Johnston
Browse files

Be a bit safer in case pw_name doesn't exist

parent 86a742f6
Branches
No related merge requests found
......@@ -683,11 +683,13 @@ static void fill_own_user() {
uid = getuid();
pw = getpwuid(uid);
if (pw == NULL || pw->pw_name == NULL) {
if (pw && pw->pw_name != NULL) {
cli_opts.own_user = m_strdup(pw->pw_name);
} else {
dropbear_log(LOG_INFO, "Warning: failed to identify current user. Trying anyway.");
cli_opts.own_user = m_strdup("unknown");
}
cli_opts.own_user = m_strdup(pw->pw_name);
}
#ifdef ENABLE_CLI_ANYTCPFWD
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment