summaryrefslogtreecommitdiffhomepage
path: root/src/sock.c
diff options
context:
space:
mode:
authorMukund Sivaraman <muks@banu.com>2008-12-08 13:39:44 +0000
committerMukund Sivaraman <muks@banu.com>2008-12-08 13:39:44 +0000
commit024b317de09a7d426973ffa16e4781ec75aaef35 (patch)
tree6994f5266e93773333bfa99fa24489ac139452a3 /src/sock.c
parent6e6f992f8cbc01ce4d6840d1a020f18846c37847 (diff)
Convert tabs to spaces
Diffstat (limited to 'src/sock.c')
-rw-r--r--src/sock.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/sock.c b/src/sock.c
index ad06d97..8da0abf 100644
--- a/src/sock.c
+++ b/src/sock.c
@@ -60,12 +60,12 @@ bind_socket (int sockfd, const char *addr)
do
{
if (bind (sockfd, res->ai_addr, res->ai_addrlen) == 0)
- break; /* success */
+ break; /* success */
}
while ((res = res->ai_next) != NULL);
freeaddrinfo (ressave);
- if (res == NULL) /* was not able to bind to any address */
+ if (res == NULL) /* was not able to bind to any address */
return -1;
return sockfd;
@@ -104,28 +104,28 @@ opensock (const char *host, int port, const char *bind_to)
{
sockfd = socket (res->ai_family, res->ai_socktype, res->ai_protocol);
if (sockfd < 0)
- continue; /* ignore this one */
+ continue; /* ignore this one */
/* Bind to the specified address */
if (bind_to)
- {
- if (bind_socket (sockfd, bind_to) < 0)
- {
- close (sockfd);
- continue; /* can't bind, so try again */
- }
- }
+ {
+ if (bind_socket (sockfd, bind_to) < 0)
+ {
+ close (sockfd);
+ continue; /* can't bind, so try again */
+ }
+ }
else if (config.bind_address)
- {
- if (bind_socket (sockfd, config.bind_address) < 0)
- {
- close (sockfd);
- continue; /* can't bind, so try again */
- }
- }
+ {
+ if (bind_socket (sockfd, config.bind_address) < 0)
+ {
+ close (sockfd);
+ continue; /* can't bind, so try again */
+ }
+ }
if (connect (sockfd, res->ai_addr, res->ai_addrlen) == 0)
- break; /* success */
+ break; /* success */
close (sockfd);
}
@@ -135,7 +135,7 @@ opensock (const char *host, int port, const char *bind_to)
if (res == NULL)
{
log_message (LOG_ERR,
- "opensock: Could not establish a connection to %s", host);
+ "opensock: Could not establish a connection to %s", host);
return -1;
}
@@ -205,16 +205,16 @@ listen_sock (uint16_t port, socklen_t * addrlen)
if (bind (listenfd, (struct sockaddr *) &addr, sizeof (addr)) < 0)
{
log_message (LOG_ERR,
- "Unable to bind listening socket because of %s",
- strerror (errno));
+ "Unable to bind listening socket because of %s",
+ strerror (errno));
return -1;
}
if (listen (listenfd, MAXLISTEN) < 0)
{
log_message (LOG_ERR,
- "Unable to start listening socket because of %s",
- strerror (errno));
+ "Unable to start listening socket because of %s",
+ strerror (errno));
return -1;
}
@@ -237,7 +237,7 @@ getsock_ip (int fd, char *ipaddr)
if (getsockname (fd, (struct sockaddr *) &name, &namelen) != 0)
{
log_message (LOG_ERR, "getsock_ip: getsockname() error: %s",
- strerror (errno));
+ strerror (errno));
return -1;
}
@@ -273,5 +273,5 @@ getpeer_information (int fd, char *ipaddr, char *string_addr)
/* Get the full host name */
return getnameinfo ((struct sockaddr *) &sa, salen,
- string_addr, HOSTNAME_LENGTH, NULL, 0, 0);
+ string_addr, HOSTNAME_LENGTH, NULL, 0, 0);
}