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
0f1b40e2
Unverified
Commit
0f1b40e2
authored
May 09, 2018
by
Serge Hallyn
Committed by
GitHub
May 09, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2308 from tych0/add-logging
fix execute when init in the container already exists
parents
f52624fa
41089848
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
5 deletions
+22
-5
conf.c
src/lxc/conf.c
+11
-3
execute.c
src/lxc/execute.c
+10
-2
start.c
src/lxc/start.c
+1
-0
No files found.
src/lxc/conf.c
View file @
0f1b40e2
...
@@ -3213,8 +3213,15 @@ static int lxc_execute_bind_init(struct lxc_handler *handler)
...
@@ -3213,8 +3213,15 @@ static int lxc_execute_bind_init(struct lxc_handler *handler)
/* If init exists in the container, don't bind mount a static one */
/* If init exists in the container, don't bind mount a static one */
p
=
choose_init
(
conf
->
rootfs
.
mount
);
p
=
choose_init
(
conf
->
rootfs
.
mount
);
if
(
p
)
{
if
(
p
)
{
free
(
p
);
char
*
old
=
p
;
return
0
;
p
=
strdup
(
old
+
strlen
(
conf
->
rootfs
.
mount
));
free
(
old
);
if
(
!
p
)
return
-
ENOMEM
;
INFO
(
"Found existing init at
\"
%s
\"
"
,
p
);
goto
out
;
}
}
ret
=
snprintf
(
path
,
PATH_MAX
,
SBINDIR
"/init.lxc.static"
);
ret
=
snprintf
(
path
,
PATH_MAX
,
SBINDIR
"/init.lxc.static"
);
...
@@ -3247,9 +3254,10 @@ static int lxc_execute_bind_init(struct lxc_handler *handler)
...
@@ -3247,9 +3254,10 @@ static int lxc_execute_bind_init(struct lxc_handler *handler)
p
=
strdup
(
destpath
+
strlen
(
conf
->
rootfs
.
mount
));
p
=
strdup
(
destpath
+
strlen
(
conf
->
rootfs
.
mount
));
if
(
!
p
)
if
(
!
p
)
return
-
ENOMEM
;
return
-
ENOMEM
;
((
struct
execute_args
*
)
handler
->
data
)
->
init_path
=
p
;
INFO
(
"Bind mounted lxc.init.static into container at
\"
%s
\"
"
,
path
);
INFO
(
"Bind mounted lxc.init.static into container at
\"
%s
\"
"
,
path
);
out:
((
struct
execute_args
*
)
handler
->
data
)
->
init_path
=
p
;
return
0
;
return
0
;
}
}
...
...
src/lxc/execute.c
View file @
0f1b40e2
...
@@ -57,12 +57,19 @@ static int execute_start(struct lxc_handler *handler, void* data)
...
@@ -57,12 +57,19 @@ static int execute_start(struct lxc_handler *handler, void* data)
if
(
lxc_log_has_valid_level
())
if
(
lxc_log_has_valid_level
())
argc_add
+=
2
;
argc_add
+=
2
;
if
(
current_config
->
logfd
!=
-
1
||
lxc_log_fd
!=
-
1
)
argc_add
+=
2
;
argv
=
malloc
((
argc
+
argc_add
)
*
sizeof
(
*
argv
));
argv
=
malloc
((
argc
+
argc_add
)
*
sizeof
(
*
argv
));
if
(
!
argv
)
if
(
!
argv
)
{
SYSERROR
(
"Allocating init args failed"
);
goto
out1
;
goto
out1
;
}
if
(
!
my_args
->
init_path
)
if
(
!
my_args
->
init_path
)
{
ERROR
(
"Init path missing"
);
goto
out2
;
goto
out2
;
}
argv
[
i
++
]
=
my_args
->
init_path
;
argv
[
i
++
]
=
my_args
->
init_path
;
...
@@ -139,6 +146,7 @@ int lxc_execute(const char *name, char *const argv[], int quiet,
...
@@ -139,6 +146,7 @@ int lxc_execute(const char *name, char *const argv[], int quiet,
{
{
struct
execute_args
args
=
{.
argv
=
argv
,
.
quiet
=
quiet
};
struct
execute_args
args
=
{.
argv
=
argv
,
.
quiet
=
quiet
};
TRACE
(
"Doing lxc_execute"
);
handler
->
conf
->
is_execute
=
1
;
handler
->
conf
->
is_execute
=
1
;
return
__lxc_start
(
name
,
handler
,
&
execute_start_ops
,
&
args
,
lxcpath
,
return
__lxc_start
(
name
,
handler
,
&
execute_start_ops
,
&
args
,
lxcpath
,
backgrounded
,
error_num
);
backgrounded
,
error_num
);
...
...
src/lxc/start.c
View file @
0f1b40e2
...
@@ -1971,6 +1971,7 @@ int lxc_start(const char *name, char *const argv[], struct lxc_handler *handler,
...
@@ -1971,6 +1971,7 @@ int lxc_start(const char *name, char *const argv[], struct lxc_handler *handler,
.
argv
=
argv
,
.
argv
=
argv
,
};
};
TRACE
(
"Doing lxc_start"
);
return
__lxc_start
(
name
,
handler
,
&
start_ops
,
&
start_arg
,
lxcpath
,
backgrounded
,
error_num
);
return
__lxc_start
(
name
,
handler
,
&
start_ops
,
&
start_arg
,
lxcpath
,
backgrounded
,
error_num
);
}
}
...
...
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