[lxc-devel] [lxc/master] af_unix: remove unlink operation

0x0916 on Github lxc-bot at linuxcontainers.org
Sat Jul 8 02:39:12 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 517 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170708/227ccb81/attachment.bin>
-------------- next part --------------
From 42c6141c5a3d1ee0800a5659770159ab3055d46e Mon Sep 17 00:00:00 2001
From: Long Wang <w at laoqinren.net>
Date: Sat, 8 Jul 2017 10:29:57 +0800
Subject: [PATCH] af_unix: remove unlink operation

It is not necessary to unlink the abstract socket pathname when
we have finished using the socket. The abstract name is automatically
removed when the socket is closed.

Signed-off-by: Long Wang <w at laoqinren.net>
---
 src/lxc/af_unix.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/src/lxc/af_unix.c b/src/lxc/af_unix.c
index 074fabb44..be7f6ce59 100644
--- a/src/lxc/af_unix.c
+++ b/src/lxc/af_unix.c
@@ -42,9 +42,6 @@ int lxc_abstract_unix_open(const char *path, int type, int flags)
 	size_t len;
 	struct sockaddr_un addr;
 
-	if (flags & O_TRUNC)
-		unlink(path);
-
 	fd = socket(PF_UNIX, type, 0);
 	if (fd < 0)
 		return -1;
@@ -86,13 +83,6 @@ int lxc_abstract_unix_open(const char *path, int type, int flags)
 
 int lxc_abstract_unix_close(int fd)
 {
-	struct sockaddr_un addr;
-	socklen_t addrlen = sizeof(addr);
-
-	if (!getsockname(fd, (struct sockaddr *)&addr, &addrlen) &&
-			addr.sun_path[0])
-		unlink(addr.sun_path);
-
 	close(fd);
 
 	return 0;


More information about the lxc-devel mailing list