Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
fe1f672f
Commit
fe1f672f
authored
Feb 17, 2014
by
S.Çağlar Onur
Committed by
Stéphane Graber
Feb 17, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
close correct side of the pipe and increase buffer size by one to handle \n
Signed-off-by:
S.Çağlar Onur
<
caglar@10ur.org
>
Acked-by:
Stéphane Graber
<
stgraber@ubuntu.com
>
parent
44bbab8c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
conf.c
src/lxc/conf.c
+5
-4
No files found.
src/lxc/conf.c
View file @
fe1f672f
...
@@ -3011,13 +3011,14 @@ void lxc_delete_network(struct lxc_handler *handler)
...
@@ -3011,13 +3011,14 @@ void lxc_delete_network(struct lxc_handler *handler)
#define LXC_USERNIC_PATH LIBEXECDIR "/lxc/lxc-user-nic"
#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
(
struct
lxc_netdev
*
netdev
,
pid_t
pid
)
static
int
unpriv_assign_nic
(
struct
lxc_netdev
*
netdev
,
pid_t
pid
)
{
{
pid_t
child
;
pid_t
child
;
int
bytes
,
pipefd
[
2
];
int
bytes
,
pipefd
[
2
];
char
*
token
,
*
saveptr
=
NULL
;
char
*
token
,
*
saveptr
=
NULL
;
/* lxc-user-nic returns "interface_name:interface_name" format */
char
buffer
[
MAX_BUFFER_SIZE
];
char
buffer
[
IFNAMSIZ
*
2
+
1
];
if
(
netdev
->
type
!=
LXC_NET_VETH
)
{
if
(
netdev
->
type
!=
LXC_NET_VETH
)
{
ERROR
(
"nic type %d not support for unprivileged use"
,
ERROR
(
"nic type %d not support for unprivileged use"
,
...
@@ -3043,7 +3044,7 @@ static int unpriv_assign_nic(struct lxc_netdev *netdev, pid_t pid)
...
@@ -3043,7 +3044,7 @@ static int unpriv_assign_nic(struct lxc_netdev *netdev, pid_t pid)
/* redirect the stdout to write-end of the pipe */
/* redirect the stdout to write-end of the pipe */
dup2
(
pipefd
[
1
],
STDOUT_FILENO
);
dup2
(
pipefd
[
1
],
STDOUT_FILENO
);
/* close the write-end of the pipe */
/* close the write-end of the pipe */
close
(
pipefd
[
0
]);
close
(
pipefd
[
1
]);
// Call lxc-user-nic pid type bridge
// Call lxc-user-nic pid type bridge
char
pidstr
[
20
];
char
pidstr
[
20
];
...
@@ -3058,7 +3059,7 @@ static int unpriv_assign_nic(struct lxc_netdev *netdev, pid_t pid)
...
@@ -3058,7 +3059,7 @@ static int unpriv_assign_nic(struct lxc_netdev *netdev, pid_t pid)
/* close the write-end of the pipe */
/* close the write-end of the pipe */
close
(
pipefd
[
1
]);
close
(
pipefd
[
1
]);
bytes
=
read
(
pipefd
[
0
],
&
buffer
,
IFNAMSIZ
*
2
+
1
);
bytes
=
read
(
pipefd
[
0
],
&
buffer
,
MAX_BUFFER_SIZE
);
if
(
bytes
<
0
)
{
if
(
bytes
<
0
)
{
SYSERROR
(
"read failed"
);
SYSERROR
(
"read failed"
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment