]> code.citadel.org Git - citadel.git/blobdiff - citadel/clientsocket.c
Merge branch 'master' of ssh://git.citadel.org/appl/gitroot/citadel
[citadel.git] / citadel / clientsocket.c
index 1abf2d89e25ba17ff4fc1e4dea662387a194465d..e71410e9fc727ec6ad5715f871085f89fd5dc0fd 100644 (file)
@@ -1,19 +1,13 @@
-/*
- * This module handles client-side sockets opened by the Citadel server (for
- * the client side of Internet protocols, etc.)   It does _not_ handle client
- * sockets for the Citadel client; for that you must look in ipc_c_tcp.c
- * (which, uncoincidentally, bears a striking similarity to this file).
- *
- * Copyright (c) 1987-2011 by the citadel.org team
- *
- * This program is open source software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License, version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
+// This module handles client-side sockets opened by the Citadel server (for
+// the client side of Internet protocols, etc.)   It does _not_ handle client
+// sockets for the Citadel client; for that you must look in ipc_c_tcp.c
+// (which, uncoincidentally, bears a striking similarity to this file).
+//
+// Copyright (c) 1987-2017 by the citadel.org team
+//
+// This program is open source software.  Use, duplication, or disclosure
+// is subject to the terms of the GNU General Public License, version 3.
+// The program is distributed without any warranty, expressed or implied.
 
 #include <stdlib.h>
 #include <unistd.h>
@@ -71,7 +65,7 @@ int sock_connect(char *host, char *service)
        for (ai = res; ai != NULL; ai = ai->ai_next) {
                sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
                if (sock < 0) {
-                       syslog(LOG_ERR, "%s: %s", host, strerror(errno));
+                       syslog(LOG_ERR, "%s: %m", host);
                        freeaddrinfo(res);
                        return(-1);
                }
@@ -81,7 +75,7 @@ int sock_connect(char *host, char *service)
                        return(sock);
                }
                else {
-                       syslog(LOG_ERR, "%s: %s", host, strerror(errno));
+                       syslog(LOG_ERR, "%s: %m", host);
                        close(sock);
                }
        }
@@ -192,7 +186,6 @@ int sock_write_timeout(int *sock, const char *buf, int nbytes, int timeout)
                        FD_ZERO(&rfds);
                        FD_SET(*sock, &rfds);
                        if (select(*sock + 1, NULL, &rfds, NULL, &tv) == -1) {
-///                            *Error = strerror(errno);
                                close (*sock);
                                *sock = -1;
                                return -1;
@@ -217,7 +210,6 @@ int sock_write_timeout(int *sock, const char *buf, int nbytes, int timeout)
                        FD_ZERO(&rfds);
                        FD_SET(*sock, &rfds);
                        if (select(*sock + 1, NULL, &rfds, NULL, &tv) == -1) {
-///                            *Error = strerror(errno);
                                close (*sock);
                                *sock = -1;
                                return -1;