[CRIU] [PATCH] ipc_ns.c: remove hardcoded sizes

Kir Kolyshkin kir at openvz.org
Tue Jan 31 17:50:14 EST 2012


Use sizeof() instead.

Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 ipc_ns.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/ipc_ns.c b/ipc_ns.c
index cac66cf..88c6b06 100644
--- a/ipc_ns.c
+++ b/ipc_ns.c
@@ -86,7 +86,7 @@ static int read_ipc_sysctl_long(char *name, u64 *data, size_t size)
 		pr_perror("Can't open %s", name);
 		return fd;
 	}
-	ret = read(fd, buf, 32);
+	ret = read(fd, buf, sizeof(buf));
 	if (ret < 0) {
 		pr_perror("Can't read %s", name);
 		ret = -errno;
@@ -110,7 +110,7 @@ static int read_ipc_sysctl(char *name, u32 *data, size_t size)
 		pr_perror("Can't open %s", name);
 		return fd;
 	}
-	ret = read(fd, buf, 32);
+	ret = read(fd, buf, sizeof(buf));
 	if (ret < 0) {
 		pr_perror("Can't read %s", name);
 		ret = -errno;
@@ -135,7 +135,7 @@ static int read_ipc_sem(u32 sem[])
 		pr_perror("Can't open %s", name);
 		return fd;
 	}
-	ret = read(fd, buf, 128);
+	ret = read(fd, buf, sizeof(buf));
 	if (ret < 0) {
 		pr_perror("Can't read %s", name);
 		ret = -errno;
-- 
1.7.5.4



More information about the CRIU mailing list