Description: if mkdir fails with -EEXIST, let it be.
Author: Serge Hallyn <serge.hallyn@ubuntu.com>
Forwarded: yes

Index: lxc/src/lxc/cgroup.c
===================================================================
--- lxc.orig/src/lxc/cgroup.c	2012-08-24 10:51:33.375144000 -0500
+++ lxc/src/lxc/cgroup.c	2012-08-24 10:59:42.293491913 -0500
@@ -357,9 +357,12 @@
 	}
 
 	/* if /sys/fs/cgroup/<cgroup>/<init-cgroup>/lxc does not exist, create it */
-	if (access(cgparent, F_OK) && mkdir(cgparent, 0755)) {
-		SYSERROR("failed to create '%s' directory", cgparent);
-		return -1;
+	if (access(cgparent, F_OK)) {
+		ret = mkdir(cgparent, 0755);
+		if (ret == -1 && errno == EEXIST) {
+			SYSERROR("failed to create '%s' directory", cgparent);
+			return -1;
+		}
 	}
 
 	/*
