[17/19] unix: unlink_sk -- Don't unlink bindmounted sockets

Submitted by Cyrill Gorcunov on Sept. 14, 2018, 2:08 p.m.

Details

Message ID 20180914140842.6462-18-gorcunov@gmail.com
State New
Series "unix: Add support for bindmounted dgram sockets"
Headers show

Commit Message

Cyrill Gorcunov Sept. 14, 2018, 2:08 p.m.
The unlink procedure is rather a cleanup before we
start creating new sockets, but bindmounted sockets
are pre-created early so we should not touch them.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 criu/sk-unix.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/criu/sk-unix.c b/criu/sk-unix.c
index e6a7bb4e0bc9..ef087bada886 100644
--- a/criu/sk-unix.c
+++ b/criu/sk-unix.c
@@ -2114,7 +2114,9 @@  static int unlink_sk(struct unix_sk_info *ui)
 {
 	int ret = 0, cwd_fd = -1, root_fd = -1, ns_fd = -1;
 
-	if (!ui->name || ui->name[0] == '\0' || (ui->ue->uflags & UNIX_UFLAGS__EXTERN))
+	if (!ui->name || ui->name[0] == '\0' ||
+	    (ui->flags & USK_BINDMOUNT) ||
+	    (ui->ue->uflags & UNIX_UFLAGS__EXTERN))
 		return 0;
 
 	if (prep_unix_sk_cwd(ui, &cwd_fd, &root_fd, NULL))