summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Garnock-Jones <tonygarnockjones@gmail.com>2010-07-02 17:05:07 +1200
committerTony Garnock-Jones <tonygarnockjones@gmail.com>2010-07-02 17:05:07 +1200
commit7478207a21fc2e1e7aea5306762578f2992ccb42 (patch)
tree5fbd0a48899b359c8689c394d1b3c492db483e4a
parentfafa16b15f7d4d9a8ae6d982fabd9371579d0b0f (diff)
downloadrabbitmq-c-github-ask-7478207a21fc2e1e7aea5306762578f2992ccb42.tar.gz
Check result of socket call (!)
-rw-r--r--librabbitmq/amqp_socket.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/librabbitmq/amqp_socket.c b/librabbitmq/amqp_socket.c
index d16c319..a78056b 100644
--- a/librabbitmq/amqp_socket.c
+++ b/librabbitmq/amqp_socket.c
@@ -85,6 +85,10 @@ int amqp_open_socket(char const *hostname,
addr.sin_addr.s_addr = * (uint32_t *) he->h_addr_list[0];
sockfd = socket(PF_INET, SOCK_STREAM, 0);
+ if (sockfd == -1) {
+ return -errno;
+ }
+
if (connect(sockfd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
int result = -errno;
close(sockfd);