mirror of
https://github.com/libssh2/libssh2.git
synced 2025-07-31 00:03:08 +03:00
bugfix: avoid using the socket if it failed to create one
This commit is contained in:
@ -94,6 +94,10 @@ int main(int argc, char *argv[])
|
|||||||
* connection
|
* connection
|
||||||
*/
|
*/
|
||||||
sock = socket(AF_INET, SOCK_STREAM, 0);
|
sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
|
if(-1 == sock) {
|
||||||
|
fprintf(stderr, "failed to create socket!\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
sin.sin_family = AF_INET;
|
sin.sin_family = AF_INET;
|
||||||
sin.sin_port = htons(22);
|
sin.sin_port = htons(22);
|
||||||
|
Reference in New Issue
Block a user