]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
tree-wide: s/send()/lxc_send_nointr()/g
authorChristian Brauner <christian.brauner@ubuntu.com>
Mon, 3 Sep 2018 12:46:13 +0000 (14:46 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 4 Sep 2018 12:05:28 +0000 (14:05 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/commands.c
src/lxc/network.c
src/lxc/start.c

index 741210bb47a5c9afc3bc9dee72013ee91b691579..b83f1c4c428775c8bbe862f0277604fc2dd78919 100644 (file)
@@ -206,7 +206,8 @@ static int lxc_cmd_rsp_send(int fd, struct lxc_cmd_rsp *rsp)
 {
        ssize_t ret;
 
-       ret = send(fd, rsp, sizeof(*rsp), MSG_NOSIGNAL);
+       errno = EMSGSIZE;
+       ret = lxc_send_nointr(fd, rsp, sizeof(*rsp), MSG_NOSIGNAL);
        if (ret < 0 || (size_t)ret != sizeof(*rsp)) {
                SYSERROR("Failed to send command response %zd", ret);
                return -1;
@@ -215,7 +216,8 @@ static int lxc_cmd_rsp_send(int fd, struct lxc_cmd_rsp *rsp)
        if (!rsp->data || rsp->datalen <= 0)
                return 0;
 
-       ret = send(fd, rsp->data, rsp->datalen, MSG_NOSIGNAL);
+       errno = EMSGSIZE;
+       ret = lxc_send_nointr(fd, rsp->data, rsp->datalen, MSG_NOSIGNAL);
        if (ret < 0 || ret != (ssize_t)rsp->datalen) {
                SYSWARN("Failed to send command response data %zd", ret);
                return -1;
@@ -242,7 +244,9 @@ static int lxc_cmd_send(const char *name, struct lxc_cmd_rr *cmd,
        if (cmd->req.datalen <= 0)
                return client_fd;
 
-       ret = send(client_fd, cmd->req.data, cmd->req.datalen, MSG_NOSIGNAL);
+       errno = EMSGSIZE;
+       ret = lxc_send_nointr(client_fd, (void *)cmd->req.data,
+                             cmd->req.datalen, MSG_NOSIGNAL);
        if (ret < 0 || ret != (ssize_t)cmd->req.datalen)
                goto on_error;
 
index a2a35baf313a8f997961725fec6d8172e965aa6f..7c965382009c8a396df950965fe3da36a1aa69c9 100644 (file)
@@ -3057,7 +3057,7 @@ int lxc_network_send_veth_names_to_child(struct lxc_handler *handler)
                if (netdev->type != LXC_NET_VETH)
                        continue;
 
-               ret = send(data_sock, netdev->name, IFNAMSIZ, MSG_NOSIGNAL);
+               ret = lxc_send_nointr(data_sock, netdev->name, IFNAMSIZ, MSG_NOSIGNAL);
                if (ret < 0)
                        return -1;
                TRACE("Sent network device name \"%s\" to child", netdev->name);
@@ -3105,14 +3105,14 @@ int lxc_network_send_name_and_ifindex_to_parent(struct lxc_handler *handler)
                struct lxc_netdev *netdev = iterator->elem;
 
                /* Send network device name in the child's namespace to parent. */
-               ret = send(data_sock, netdev->name, IFNAMSIZ, MSG_NOSIGNAL);
+               ret = lxc_send_nointr(data_sock, netdev->name, IFNAMSIZ, MSG_NOSIGNAL);
                if (ret < 0)
                        return -1;
 
                /* Send network device ifindex in the child's namespace to
                 * parent.
                 */
-               ret = send(data_sock, &netdev->ifindex, sizeof(netdev->ifindex), MSG_NOSIGNAL);
+               ret = lxc_send_nointr(data_sock, &netdev->ifindex, sizeof(netdev->ifindex), MSG_NOSIGNAL);
                if (ret < 0)
                        return -1;
        }
index b5c24897452affc27ee9214352f856c672c5c1d4..4fe5c8d85ecda6b7b13bd3c2f431acc5912d260e 100644 (file)
@@ -61,6 +61,7 @@
 #include "conf.h"
 #include "confile_utils.h"
 #include "error.h"
+#include "file_utils.h"
 #include "list.h"
 #include "lsm/lsm.h"
 #include "log.h"
@@ -440,16 +441,9 @@ int lxc_serve_state_clients(const char *name, struct lxc_handler *handler,
                TRACE("Sending state %s to state client %d",
                      lxc_state2str(state), client->clientfd);
 
-       again:
-               ret = send(client->clientfd, &msg, sizeof(msg), MSG_NOSIGNAL);
-               if (ret <= 0) {
-                       if (errno == EINTR) {
-                               TRACE("Caught EINTR; retrying");
-                               goto again;
-                       }
-
+               ret = lxc_send_nointr(client->clientfd, &msg, sizeof(msg), MSG_NOSIGNAL);
+               if (ret <= 0)
                        SYSERROR("Failed to send message to client");
-               }
 
                /* kick client from list */
                lxc_list_del(cur);