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 */
|
||||
|
||||
struct socket;
|
||||
void ssh_socket_init(void);
|
||||
int ssh_socket_init(void);
|
||||
struct socket *ssh_socket_new(SSH_SESSION *session);
|
||||
void ssh_socket_free(struct socket *s);
|
||||
void ssh_socket_set_fd(struct socket *s, socket_t fd);
|
||||
|
@ -453,7 +453,10 @@ int ssh_connect(SSH_SESSION *session) {
|
||||
leave_function();
|
||||
return SSH_ERROR;
|
||||
}
|
||||
ssh_socket_init();
|
||||
if (ssh_socket_init() < 0) {
|
||||
leave_function();
|
||||
return SSH_ERROR;
|
||||
}
|
||||
|
||||
if (options->fd == -1 && options->host == NULL) {
|
||||
ssh_set_error(session, SSH_FATAL, "Hostname required");
|
||||
|
@ -105,7 +105,9 @@ int ssh_bind_listen(SSH_BIND *ssh_bind){
|
||||
int fd;
|
||||
if(!ssh_bind->options)
|
||||
return -1;
|
||||
ssh_socket_init();
|
||||
if (ssh_socket_init() < 0) {
|
||||
return -1;
|
||||
}
|
||||
host=ssh_bind->options->bindaddr;
|
||||
if(!host)
|
||||
host="0.0.0.0";
|
||||
|
@ -75,14 +75,16 @@ struct socket {
|
||||
* \internal
|
||||
* \brief inits the socket system (windows specific)
|
||||
*/
|
||||
void ssh_socket_init(void) {
|
||||
int ssh_socket_init(void) {
|
||||
#ifdef _WIN32
|
||||
struct WSAData wsaData;
|
||||
|
||||
if (WSAStartup(MAKEWORD(2, 0), &wsaData)) {
|
||||
/* FIXME print error */
|
||||
/* Initiates use of the Winsock DLL by a process. */
|
||||
if (WSAStartup(MAKEWORD(2, 0), &wsaData) != 0) {
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* \internal
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user