]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
conf: increase lxc-user-nic buffer
authorChristian Brauner <christian.brauner@ubuntu.com>
Sun, 27 Aug 2017 12:48:52 +0000 (14:48 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 29 Aug 2017 20:54:50 +0000 (22:54 +0200)
This will allow us log more detailed failures.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/conf.c

index defa69060373a52757a4bcd04bce5d76a943b932..9baf46b2b2df2eb43c1a409c9dcb6f3ebe8ed162 100644 (file)
@@ -3179,9 +3179,6 @@ bool lxc_delete_network(struct lxc_handler *handler)
 }
 
 #define LXC_USERNIC_PATH LIBEXECDIR "/lxc/lxc-user-nic"
-
-/* lxc-user-nic returns "interface_name:interface_name\n" */
-#define MAX_BUFFER_SIZE IFNAMSIZ * 2 + 2
 static int unpriv_assign_nic(const char *lxcpath, char *lxcname,
                             struct lxc_netdev *netdev, pid_t pid)
 {
@@ -3190,7 +3187,7 @@ static int unpriv_assign_nic(const char *lxcpath, char *lxcname,
        int bytes, pipefd[2];
        char *token, *saveptr = NULL;
        char netdev_link[IFNAMSIZ + 1];
-       char buffer[MAX_BUFFER_SIZE] = {0};
+       char buffer[MAXPATHLEN] = {0};
 
        if (netdev->type != LXC_NET_VETH) {
                ERROR("nic type %d not support for unprivileged use",
@@ -3256,7 +3253,7 @@ static int unpriv_assign_nic(const char *lxcpath, char *lxcname,
        /* close the write-end of the pipe */
        close(pipefd[1]);
 
-       bytes = read(pipefd[0], &buffer, MAX_BUFFER_SIZE);
+       bytes = read(pipefd[0], &buffer, MAXPATHLEN);
        if (bytes < 0) {
                SYSERROR("Failed to read from pipe file descriptor.");
                close(pipefd[0]);
@@ -5122,7 +5119,7 @@ int lxc_unpriv_delete_nic(const char *lxcpath, char *lxcname,
 {
        pid_t child;
        int bytes, pipefd[2];
-       char buffer[MAX_BUFFER_SIZE] = {0};
+       char buffer[MAXPATHLEN] = {0};
 
        if (netdev->type != LXC_NET_VETH) {
                ERROR("nic type %d not support for unprivileged use",
@@ -5181,7 +5178,7 @@ int lxc_unpriv_delete_nic(const char *lxcpath, char *lxcname,
        /* close the write-end of the pipe */
        close(pipefd[1]);
 
-       bytes = read(pipefd[0], &buffer, MAX_BUFFER_SIZE);
+       bytes = read(pipefd[0], &buffer, MAXPATHLEN);
        if (bytes < 0) {
                SYSERROR("Failed to read from pipe file descriptor.");
                close(pipefd[0]);