[Devel] [PATCH 6/7] spfs: return duplicated socket from usernsd
Andrei Vagin
avagin at virtuozzo.com
Wed Dec 20 23:01:41 MSK 2017
On Wed, Dec 20, 2017 at 07:07:16PM +0300, Stanislav Kinsburskiy wrote:
> Usernsd closes socket when sent.
>
> https://jira.sw.ru/browse/PSBM-79462
>
> Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
> ---
> criu/spfs.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/criu/spfs.c b/criu/spfs.c
> index da19179..857a167 100644
> --- a/criu/spfs.c
> +++ b/criu/spfs.c
> @@ -162,11 +162,19 @@ static int start_spfs_manager(void)
> static int get_spfs_mngr_sock(void *start, int fd, pid_t pid)
> {
> int sock;
> + int sfd;
>
> sock = get_service_fd(SPFS_MNGR_SK);
> if (sock < 0 && start)
> sock = start_spfs_manager();
> - return sock;
> + if (sock < 0)
> + return sock;
> +
start_spfs_manager() returns a descriptor which has to be closed.
You need to dup a descriptor, only if it is a service one.
> + sfd = dup(sock);
> + if (sfd < 0)
> + pr_perror("failed to duplicate socket %d", sock);
> +
> + return sfd;
> }
>
> static int request_spfs_mngr_sock(bool *start_mngr)
>
More information about the Devel
mailing list