[mdadm/f16: 2/5] Fix build issue with cgroups workaround patch

Jes Sorensen jsorensen at fedoraproject.org
Fri Nov 30 17:47:50 UTC 2012


commit ecbec5e0c43a8febdd5c8344eb5ed05032474f22
Author: Jes Sorensen <Jes.Sorensen at redhat.com>
Date:   Fri Nov 30 15:54:40 2012 +0100

    Fix build issue with cgroups workaround patch
    
    Signed-off-by: Jes Sorensen <Jes.Sorensen at redhat.com>

 mdadm-3.2.6-cgroup.patch |   12 ++++++++----
 1 files 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)


More information about the scm-commits mailing list