Add error checks to setter.

git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@473 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
Andreas Schneider
2009-04-14 14:40:50 +00:00
parent c847e13c47
commit 118d4ee131

View File

@@ -142,10 +142,15 @@ void ssh_cleanup(SSH_SESSION *session) {
*/
void ssh_silent_disconnect(SSH_SESSION *session) {
enter_function();
if (session == NULL) {
return;
}
ssh_socket_close(session->socket);
session->alive = 0;
ssh_disconnect(session);
//leave_function();
/* FIXME: leave_function(); ??? */
}
/** \brief set the options for the current session
@@ -155,6 +160,10 @@ void ssh_silent_disconnect(SSH_SESSION *session){
* \see ssh_options_new()
*/
void ssh_set_options(SSH_SESSION *session, SSH_OPTIONS *options) {
if (session == NULL || options == NULL) {
return;
}
session->options = options;
session->log_verbosity = options->log_verbosity;
}
@@ -165,6 +174,10 @@ void ssh_set_options(SSH_SESSION *session, SSH_OPTIONS *options){
* \bug nonblocking code is in development and won't work as expected
*/
void ssh_set_blocking(SSH_SESSION *session, int blocking) {
if (session == NULL) {
return;
}
session->blocking = blocking ? 1 : 0;
}
@@ -175,8 +188,11 @@ void ssh_set_blocking(SSH_SESSION *session,int blocking){
* \return file descriptor of the connection, or -1 if it is
* not connected
*/
socket_t ssh_get_fd(SSH_SESSION *session) {
if (session == NULL) {
return -1;
}
return ssh_socket_get_fd(session->socket);
}
@@ -184,6 +200,10 @@ socket_t ssh_get_fd(SSH_SESSION *session){
* \param session ssh session
*/
void ssh_set_fd_toread(SSH_SESSION *session) {
if (session == NULL) {
return;
}
ssh_socket_set_toread(session->socket);
}
@@ -191,14 +211,21 @@ void ssh_set_fd_toread(SSH_SESSION *session){
* \param session ssh session
*/
void ssh_set_fd_towrite(SSH_SESSION *session) {
ssh_socket_set_towrite(session->socket);
if (session == NULL) {
return;
}
ssh_socket_set_towrite(session->socket);
}
/** \brief say the session it has an exception to catch on the file descriptor
* \param session ssh session
*/
void ssh_set_fd_except(SSH_SESSION *session) {
if (session == NULL) {
return;
}
ssh_socket_set_except(session->socket);
}