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
47378d53
Commit
47378d53
authored
Nov 29, 2016
by
Christian Brauner
Committed by
Stéphane Graber
Nov 30, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
monitord: close mainloop on exit if we opened it
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
5267c49f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
10 deletions
+13
-10
lxc_monitord.c
src/lxc/lxc_monitord.c
+11
-9
mainloop.c
src/lxc/mainloop.c
+0
-1
monitor.c
src/lxc/monitor.c
+2
-0
No files found.
src/lxc/lxc_monitord.c
View file @
47378d53
...
@@ -348,6 +348,8 @@ int main(int argc, char *argv[])
...
@@ -348,6 +348,8 @@ int main(int argc, char *argv[])
char
logpath
[
PATH_MAX
];
char
logpath
[
PATH_MAX
];
sigset_t
mask
;
sigset_t
mask
;
char
*
lxcpath
=
argv
[
1
];
char
*
lxcpath
=
argv
[
1
];
bool
mainloop_opened
=
false
;
bool
monitord_created
=
false
;
if
(
argc
!=
3
)
{
if
(
argc
!=
3
)
{
fprintf
(
stderr
,
fprintf
(
stderr
,
...
@@ -395,10 +397,11 @@ int main(int argc, char *argv[])
...
@@ -395,10 +397,11 @@ int main(int argc, char *argv[])
ERROR
(
"Failed to create mainloop."
);
ERROR
(
"Failed to create mainloop."
);
goto
on_error
;
goto
on_error
;
}
}
mainloop_opened
=
true
;
if
(
lxc_monitord_create
(
&
mon
))
{
if
(
lxc_monitord_create
(
&
mon
))
goto
on_error
;
goto
on_error
;
}
monitord_created
=
true
;
/* sync with parent, we're ignoring the return from write
/* sync with parent, we're ignoring the return from write
* because regardless if it works or not, the following
* because regardless if it works or not, the following
...
@@ -425,14 +428,13 @@ int main(int argc, char *argv[])
...
@@ -425,14 +428,13 @@ int main(int argc, char *argv[])
}
}
}
}
lxc_mainloop_close
(
&
mon
.
descr
);
on_signal:
lxc_monitord_cleanup
();
ret
=
EXIT_SUCCESS
;
ret
=
EXIT_SUCCESS
;
on_error:
on_error:
exit
(
ret
);
if
(
monitord_created
)
lxc_monitord_cleanup
();
if
(
mainloop_opened
)
lxc_mainloop_close
(
&
mon
.
descr
);
on_signal:
exit
(
ret
);
lxc_monitord_cleanup
();
exit
(
EXIT_SUCCESS
);
}
}
src/lxc/mainloop.c
View file @
47378d53
...
@@ -161,4 +161,3 @@ int lxc_mainloop_close(struct lxc_epoll_descr *descr)
...
@@ -161,4 +161,3 @@ int lxc_mainloop_close(struct lxc_epoll_descr *descr)
return
close
(
descr
->
epfd
);
return
close
(
descr
->
epfd
);
}
}
src/lxc/monitor.c
View file @
47378d53
...
@@ -325,6 +325,7 @@ int lxc_monitord_spawn(const char *lxcpath)
...
@@ -325,6 +325,7 @@ int lxc_monitord_spawn(const char *lxcpath)
}
}
if
(
pid2
)
{
if
(
pid2
)
{
DEBUG
(
"Trying to sync with child process."
);
char
c
;
char
c
;
/* Wait for daemon to create socket. */
/* Wait for daemon to create socket. */
close
(
pipefd
[
1
]);
close
(
pipefd
[
1
]);
...
@@ -339,6 +340,7 @@ int lxc_monitord_spawn(const char *lxcpath)
...
@@ -339,6 +340,7 @@ int lxc_monitord_spawn(const char *lxcpath)
close
(
pipefd
[
0
]);
close
(
pipefd
[
0
]);
DEBUG
(
"Sucessfully synced with child process."
);
exit
(
EXIT_SUCCESS
);
exit
(
EXIT_SUCCESS
);
}
}
...
...
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