bugfix: avoid using the socket if it failed to create one
This commit is contained in:
parent
03815483be
commit
c28fa65424
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user