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
7c76f495
Unverified
Commit
7c76f495
authored
Jan 19, 2018
by
Christian Brauner
Committed by
GitHub
Jan 19, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2095 from tych0/remove-lxc-init
unlink lxc-init
parents
2c3a005d
58fb9c8e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
lxc_init.c
src/lxc/lxc_init.c
+26
-0
No files found.
src/lxc/lxc_init.c
View file @
7c76f495
...
...
@@ -195,6 +195,30 @@ static void kill_children(pid_t pid)
fclose
(
f
);
}
static
void
remove_self
(
void
)
{
char
path
[
PATH_MAX
];
ssize_t
n
;
n
=
readlink
(
"/proc/self/exe"
,
path
,
sizeof
(
path
));
if
(
n
<
0
)
{
SYSERROR
(
"Failed to readlink
\"
/proc/self/exe
\"
"
);
return
;
}
path
[
n
]
=
0
;
if
(
umount2
(
path
,
MNT_DETACH
)
<
0
)
{
SYSERROR
(
"Failed to unmount
\"
%s
\"
"
,
path
);
return
;
}
if
(
unlink
(
path
)
<
0
)
{
SYSERROR
(
"Failed to unlink
\"
%s
\"
"
,
path
);
return
;
}
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
i
,
ret
;
...
...
@@ -296,6 +320,8 @@ int main(int argc, char *argv[])
lxc_setup_fs
();
remove_self
();
pid
=
fork
();
if
(
pid
<
0
)
exit
(
EXIT_FAILURE
);
...
...
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