From: Christian Brauner Date: Sun, 27 Aug 2017 12:48:52 +0000 (+0200) Subject: conf: increase lxc-user-nic buffer X-Git-Tag: lxc-2.1.0~14^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=890928153e36299f7f1fc7a1147a63ae748acd61;p=thirdparty%2Flxc.git conf: increase lxc-user-nic buffer This will allow us log more detailed failures. Signed-off-by: Christian Brauner --- diff --git a/src/lxc/conf.c b/src/lxc/conf.c index d2a1f7cad..eeefeee6b 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -3286,9 +3286,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) { @@ -3297,7 +3294,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", @@ -3363,7 +3360,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]); @@ -5148,7 +5145,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", @@ -5207,7 +5204,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]);