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
cbb8254f
Unverified
Commit
cbb8254f
authored
May 04, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
execute: use static buffer
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
f5d5324b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
12 deletions
+14
-12
execute.c
src/lxc/execute.c
+14
-12
No files found.
src/lxc/execute.c
View file @
cbb8254f
...
...
@@ -43,11 +43,12 @@ struct execute_args {
static
int
execute_start
(
struct
lxc_handler
*
handler
,
void
*
data
)
{
int
j
,
i
=
0
,
log
=
-
1
;
int
argc_add
,
j
;
char
**
argv
;
int
argc
=
0
,
i
=
0
,
logfd
=
-
1
;
struct
execute_args
*
my_args
=
data
;
char
**
argv
,
*
logfd
;
int
argc
=
0
,
argc_add
;
char
*
initpath
;
char
logfile
[
LXC_PROC_PID_FD_LEN
];
while
(
my_args
->
argv
[
argc
++
])
;
...
...
@@ -56,8 +57,10 @@ static int execute_start(struct lxc_handler *handler, void* data)
argc_add
=
5
;
if
(
my_args
->
quiet
)
argc_add
++
;
if
(
!
handler
->
conf
->
rootfs
.
path
)
argc_add
+=
2
;
if
(
lxc_log_has_valid_level
())
argc_add
+=
2
;
...
...
@@ -82,24 +85,24 @@ static int execute_start(struct lxc_handler *handler, void* data)
}
if
(
current_config
->
logfd
!=
-
1
||
lxc_log_fd
!=
-
1
)
{
int
ret
;
int
to_dup
=
current_config
->
logfd
;
if
(
current_config
->
logfd
==
-
1
)
to_dup
=
lxc_log_fd
;
log
=
dup
(
to_dup
);
if
(
log
<
0
)
{
SYSERROR
(
"
dup of log fd failed
"
);
log
fd
=
dup
(
to_dup
);
if
(
log
fd
<
0
)
{
SYSERROR
(
"
Failed to duplicate log file descriptor
"
);
goto
out2
;
}
if
(
asprintf
(
&
logfd
,
"/proc/1/fd/%d"
,
log
)
<
0
)
{
ERROR
(
"Couldn't allocate memory for log string"
);
ret
=
snprintf
(
logfile
,
sizeof
(
logfile
),
"/proc/1/fd/%d"
,
logfd
);
if
(
ret
<
0
||
(
size_t
)
ret
>=
sizeof
(
logfile
))
goto
out3
;
}
argv
[
i
++
]
=
"-o"
;
argv
[
i
++
]
=
logf
d
;
argv
[
i
++
]
=
logf
ile
;
}
if
(
my_args
->
quiet
)
...
...
@@ -121,9 +124,8 @@ static int execute_start(struct lxc_handler *handler, void* data)
SYSERROR
(
"Failed to exec %s"
,
argv
[
0
]);
free
(
initpath
);
free
(
logfd
);
out3:
close
(
log
);
close
(
log
fd
);
out2:
free
(
argv
);
out1:
...
...
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