[CRIU] [PATCH] zdtm: ipc_namespace -- Make sure queues_max is not out of range value

Cyrill Gorcunov gorcunov at openvz.org
Mon Jun 4 13:09:53 EDT 2012


Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 test/zdtm/live/static/ipc_namespace.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/zdtm/live/static/ipc_namespace.c b/test/zdtm/live/static/ipc_namespace.c
index 6183c47..b660efc 100644
--- a/test/zdtm/live/static/ipc_namespace.c
+++ b/test/zdtm/live/static/ipc_namespace.c
@@ -209,7 +209,7 @@ static int rand_ipc_sysctl(char *name, unsigned int val)
 	sprintf(buf, "%d\n", val);
 	ret = write(fd, buf, 32);
 	if (ret < 0) {
-		err("Can't write %s\n", name);
+		err("Can't write %u into %s\n", val, name);
 		return -errno;
 	}
 	close(fd);
@@ -263,7 +263,7 @@ static int rand_ipc_ns(void)
 
 
 	if (!ret)
-		ret = rand_ipc_sysctl("/proc/sys/fs/mqueue/queues_max", (unsigned)lrand48());
+		ret = rand_ipc_sysctl("/proc/sys/fs/mqueue/queues_max", (((unsigned)lrand48()) % 1023) + 1);
 	if (!ret)
 		ret = rand_ipc_sysctl("/proc/sys/fs/mqueue/msg_max", (unsigned)lrand48() & (32768 * sizeof(void)/4 - 1));
 	if (!ret)
-- 
1.7.7.6



More information about the CRIU mailing list