bugfix: avoid using the socket if it failed to create one

This commit is contained in:
Daniel Stenberg 2010-04-27 15:18:40 +02:00
parent 03815483be
commit c28fa65424

View File

@ -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);