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:
8
util.c
8
util.c
@@ -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");
|
||||
|
Reference in New Issue
Block a user