}
#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)
{
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",
/* 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]);
{
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",
/* 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]);