[lxc-devel] [PATCH 5/5] lxclock: don't try to chown/chmod the dirname(lockfile)

serge.hallyn at ubuntu.com serge.hallyn at ubuntu.com
Tue Jul 23 19:39:13 UTC 2013


From: Serge Hallyn <serge.hallyn at ubuntu.com>

We were trying to chown and chmod it to the same permissions as
the container's lxcpath.  I think that's the wrong thing to do.

Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
---
 src/lxc/lxclock.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/src/lxc/lxclock.c b/src/lxc/lxclock.c
index 43e76fa..b595455 100644
--- a/src/lxc/lxclock.c
+++ b/src/lxc/lxclock.c
@@ -45,7 +45,6 @@ static char *lxclock_name(const char *p, const char *n)
 	int len;
 	char *dest;
 	const char *rundir;
-	struct stat sb;
 
 	/* lockfile will be:
 	 * "/run" + "/lock/lxc/$lxcpath/$lxcname + '\0' if root
@@ -77,15 +76,6 @@ static char *lxclock_name(const char *p, const char *n)
 		return NULL;
 	}
 
-	ret = stat(p, &sb);
-	if (ret == 0) {
-		// best effort.  If this fails, ignore it
-		if (chown(dest, sb.st_uid, sb.st_gid) < 0)
-			ERROR("Failed ot set owner for lockdir %s\n", dest);
-		if (chmod(dest, sb.st_mode) < 0)
-			ERROR("Failed to set mode for lockdir %s\n", dest);
-	}
-
 	ret = snprintf(dest, len, "%s/lock/lxc/%s/%s", rundir, p, n);
 	if (ret < 0 || ret >= len) {
 		free(dest);
-- 
1.8.1.2





More information about the lxc-devel mailing list