From ecbec5e0c43a8febdd5c8344eb5ed05032474f22 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Fri, 30 Nov 2012 15:54:40 +0100 Subject: [PATCH] Fix build issue with cgroups workaround patch Signed-off-by: Jes Sorensen --- mdadm-3.2.6-cgroup.patch | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/mdadm-3.2.6-cgroup.patch b/mdadm-3.2.6-cgroup.patch index 76522cb..575fcc4 100644 --- a/mdadm-3.2.6-cgroup.patch +++ b/mdadm-3.2.6-cgroup.patch @@ -1,23 +1,27 @@ diff -up mdadm-3.2.6/util.c.cgroup mdadm-3.2.6/util.c --- mdadm-3.2.6/util.c.cgroup 2012-11-15 16:48:03.327035349 -0500 +++ mdadm-3.2.6/util.c 2012-11-15 17:07:16.628751041 -0500 -@@ -1611,6 +1611,21 @@ int mdmon_running(int devnum) +@@ -1611,6 +1611,25 @@ int mdmon_running(int devnum) return 0; } -+void set_cgroup(char *group) ++int set_cgroup(char *group) +{ + char pid[8]; + char pathbuf[PATH_MAX]; -+ int tasks_fd; ++ int tasks_fd, n; + + snprintf(pathbuf, PATH_MAX, "/sys/fs/cgroup/%s/tasks", group); + tasks_fd = open(pathbuf, O_WRONLY); + if (tasks_fd >= 0) { + snprintf(pid, sizeof(pid), "%d", getpid()); -+ write(tasks_fd, pid, strlen(pid)); ++ n = write(tasks_fd, pid, strlen(pid)); + close(tasks_fd); ++ if (n != (int)strlen(pid)) { ++ return -1; ++ } + } ++ return 0; +} + int start_mdmon(int devnum)