mirror of
https://github.com/troglobit/finit.git
synced 2026-11-14 19:03:16 +00:00
cgroup: Skip mkdir() and subtree control if group already exists
- No point in doing it twice - Don't anger the gods (possible kernel bugs) Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
e3c424e129
commit
19b18afac9
1 file changed
+10
-8
+10
-8
@@ -86,16 +86,18 @@ static void group_init(char *path, int leaf, const char *cfg)
|
|||||||
{
|
{
|
||||||
char *ptr, *s;
|
char *ptr, *s;
|
||||||
|
|
||||||
if (mkdir(path, 0755) && EEXIST != errno) {
|
if (!fisdir(path)) {
|
||||||
_pe("Failed creating cgroup %s", path);
|
if (mkdir(path, 0755)) {
|
||||||
return;
|
_pe("Failed creating cgroup %s", path);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* enable detected controllers on domain groups */
|
||||||
|
if (!leaf && fnwrite(controllers, "%s/cgroup.subtree_control", path))
|
||||||
|
_pe("Failed enabling %s for %s", controllers, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* enable detected controllers on domain groups */
|
if (!cfg || !cfg[0])
|
||||||
if (!leaf && fnwrite(controllers, "%s/cgroup.subtree_control", path))
|
|
||||||
_pe("Failed enabling %s for %s", controllers, path);
|
|
||||||
|
|
||||||
if (!cfg)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
s = strdupa(cfg);
|
s = strdupa(cfg);
|
||||||
|
|||||||
Reference in new issue
Block a user