[CRIU] [crtools-bot] ipc_ns.c: remove hardcoded sizes

Cyrill Gorcunov gorcunov at openvz.org
Tue Jan 31 17:55:16 EST 2012


The commit is pushed to "master" and will appear on git://github.com/cyrillos/crtools.git
------>
commit c7168143a3ef0f66d287a4b59290b669034f2bc3
Author: Kir Kolyshkin <kir at openvz.org>
Date:   Wed Feb 1 02:50:14 2012 +0400

    ipc_ns.c: remove hardcoded sizes
    
    Use sizeof() instead.
    
    Signed-off-by: Kir Kolyshkin <kir at openvz.org>
    Signed-off-by: Cyrill Gorcunov <gorcunov 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;


More information about the CRIU mailing list