[Devel] [PATCH v2 6/7] spfs: return duplicated socket from usernsd

Stanislav Kinsburskiy skinsbursky at virtuozzo.com
Thu Dec 21 14:07:24 MSK 2017


Usernsd closes socket when sent.

https://jira.sw.ru/browse/PSBM-79462

v2: duplicate only service descriptor

Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
---
 criu/spfs.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/criu/spfs.c b/criu/spfs.c
index 7ce30e7..6ce2ac8 100644
--- a/criu/spfs.c
+++ b/criu/spfs.c
@@ -164,8 +164,13 @@ static int get_spfs_mngr_sock(void *start, int fd, pid_t pid)
 	int sock;
 
 	sock = get_service_fd(SPFS_MNGR_SK);
-	if (sock < 0 && start)
+	if (sock != -1) {
+		sock = dup(sock);
+		if (sock < 0)
+			pr_perror("failed to duplicate SPFS manager socket\n");
+	} else if (start)
 		sock = start_spfs_manager();
+
 	return sock;
 }
 



More information about the Devel mailing list