2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00

page-server: Don't setup options in parent task

When service starts page server all the preparations (log, wdir, img dir, etc.)
happen in parent task, then we fork page server.

This is OK for now, but when we will serve several requests per connection, all
these resources would be leaked in parent.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov
2014-09-04 20:39:07 +04:00
parent 66170c6bd7
commit b47b0201f3
6 changed files with 36 additions and 11 deletions

8
util.c
View File

@@ -560,7 +560,7 @@ out:
return ret;
}
int cr_daemon(int nochdir, int noclose)
int cr_daemon(int nochdir, int noclose, int *keep_fd, int close_fd)
{
int pid;
@@ -580,6 +580,12 @@ int cr_daemon(int nochdir, int noclose)
if (!noclose) {
int fd;
if (close_fd != -1)
close(close_fd);
if (*keep_fd != -1)
*keep_fd = dup2(*keep_fd, 3);
fd = open("/dev/null", O_RDWR);
if (fd < 0) {
pr_perror("Can't open /dev/null");