aboutsummaryrefslogtreecommitdiff
path: root/libssh
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-05-05 07:42:07 +0000
committerAndreas Schneider <mail@cynapses.org>2009-05-05 07:42:07 +0000
commitce1a5d75785c4954b8729107ae663fcb6c6e7265 (patch)
treee7a6e97d7f53c25eda9f6d0482addc3a80b29db6 /libssh
parent57b7e7339429c5060a0a093be3e053bef14f2f61 (diff)
downloadlibssh-ce1a5d75785c4954b8729107ae663fcb6c6e7265.tar.gz
libssh-ce1a5d75785c4954b8729107ae663fcb6c6e7265.tar.xz
libssh-ce1a5d75785c4954b8729107ae663fcb6c6e7265.zip
Reorder and format socket blocking functions.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@725 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh')
-rw-r--r--libssh/connect.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/libssh/connect.c b/libssh/connect.c
index ec77ae3..0b0fc83 100644
--- a/libssh/connect.c
+++ b/libssh/connect.c
@@ -58,32 +58,36 @@
#error "Your system must have getaddrinfo()"
#endif
-#ifndef _WIN32
-static void sock_set_nonblocking(socket_t sock) {
- fcntl(sock,F_SETFL,O_NONBLOCK);
-}
-static void sock_set_blocking(socket_t sock){
- fcntl(sock,F_SETFL,0);
-}
-#else
+#ifdef _WIN32
static void sock_set_nonblocking(socket_t sock) {
- u_long nonblocking = 1;
- ioctlsocket(sock, FIONBIO, &nonblocking);
+ u_long nonblocking = 1;
+ ioctlsocket(sock, FIONBIO, &nonblocking);
}
-static void sock_set_blocking(socket_t sock){
- u_long nonblocking = 0;
- ioctlsocket(sock, FIONBIO, &nonblocking);
+
+static void sock_set_blocking(socket_t sock) {
+ u_long nonblocking = 0;
+ ioctlsocket(sock, FIONBIO, &nonblocking);
}
#ifndef gai_strerror
-char WSAAPI *gai_strerrorA(int code){
- static char buffer[256];
- snprintf(buffer,256,"Undetermined error code (%d)",code);
- return buffer;
+char WSAAPI *gai_strerrorA(int code) {
+ static char buf[256];
+
+ snprintf(buf, sizeof(buf), "Undetermined error code (%d)", code);
+
+ return buf;
}
-#endif
+#endif /* gai_strerror */
-#endif
+#else /* _WIN32 */
+static void sock_set_nonblocking(socket_t sock) {
+ fcntl(sock, F_SETFL, O_NONBLOCK);
+}
+
+static void sock_set_blocking(socket_t sock) {
+ fcntl(sock, F_SETFL, 0);
+}
+#endif /* _WIN32 */
static int getai(const char *host, int port, struct addrinfo **ai)
{