client: don't crash if can't open gui_rpc_auth.cfg

This commit is contained in:
David Anderson 2017-04-21 11:30:06 -07:00
parent e0841d54c4
commit 2179ec6d46
1 changed files with 8 additions and 7 deletions

View File

@ -162,13 +162,14 @@ void GUI_RPC_CONN_SET::get_password() {
msg_printf(NULL, MSG_USER_ALERT,
"Can't open gui_rpc_auth.cfg - fix permissions"
);
}
retval = fputs(password, f);
fclose(f);
if (retval == EOF) {
msg_printf(NULL, MSG_USER_ALERT,
"Can't write gui_rpc_auth.cfg - fix permissions"
);
} else {
retval = fputs(password, f);
fclose(f);
if (retval == EOF) {
msg_printf(NULL, MSG_USER_ALERT,
"Can't write gui_rpc_auth.cfg - fix permissions"
);
}
}
#ifndef _WIN32
// if someone can read the password,