Add a return value to ssh_socket_init().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@494 7dcaeef0-15fb-0310-b436-a5af3365683c
Этот коммит содержится в:
родитель
94021dcdb5
Коммит
74a06555f6
@ -474,7 +474,7 @@ STRING *agent_sign_data(struct ssh_session *session,
|
|||||||
/* socket.c */
|
/* socket.c */
|
||||||
|
|
||||||
struct socket;
|
struct socket;
|
||||||
void ssh_socket_init(void);
|
int ssh_socket_init(void);
|
||||||
struct socket *ssh_socket_new(SSH_SESSION *session);
|
struct socket *ssh_socket_new(SSH_SESSION *session);
|
||||||
void ssh_socket_free(struct socket *s);
|
void ssh_socket_free(struct socket *s);
|
||||||
void ssh_socket_set_fd(struct socket *s, socket_t fd);
|
void ssh_socket_set_fd(struct socket *s, socket_t fd);
|
||||||
|
@ -453,7 +453,10 @@ int ssh_connect(SSH_SESSION *session) {
|
|||||||
leave_function();
|
leave_function();
|
||||||
return SSH_ERROR;
|
return SSH_ERROR;
|
||||||
}
|
}
|
||||||
ssh_socket_init();
|
if (ssh_socket_init() < 0) {
|
||||||
|
leave_function();
|
||||||
|
return SSH_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
if (options->fd == -1 && options->host == NULL) {
|
if (options->fd == -1 && options->host == NULL) {
|
||||||
ssh_set_error(session, SSH_FATAL, "Hostname required");
|
ssh_set_error(session, SSH_FATAL, "Hostname required");
|
||||||
|
@ -105,7 +105,9 @@ int ssh_bind_listen(SSH_BIND *ssh_bind){
|
|||||||
int fd;
|
int fd;
|
||||||
if(!ssh_bind->options)
|
if(!ssh_bind->options)
|
||||||
return -1;
|
return -1;
|
||||||
ssh_socket_init();
|
if (ssh_socket_init() < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
host=ssh_bind->options->bindaddr;
|
host=ssh_bind->options->bindaddr;
|
||||||
if(!host)
|
if(!host)
|
||||||
host="0.0.0.0";
|
host="0.0.0.0";
|
||||||
|
@ -75,14 +75,16 @@ struct socket {
|
|||||||
* \internal
|
* \internal
|
||||||
* \brief inits the socket system (windows specific)
|
* \brief inits the socket system (windows specific)
|
||||||
*/
|
*/
|
||||||
void ssh_socket_init(void) {
|
int ssh_socket_init(void) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
struct WSAData wsaData;
|
struct WSAData wsaData;
|
||||||
|
|
||||||
if (WSAStartup(MAKEWORD(2, 0), &wsaData)) {
|
/* Initiates use of the Winsock DLL by a process. */
|
||||||
/* FIXME print error */
|
if (WSAStartup(MAKEWORD(2, 0), &wsaData) != 0) {
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* \internal
|
* \internal
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user