[CRIU] [crtools-bot] sockets: Add nr_icons member to track number of icons instead of zero ended array

Cyrill Gorcunov gorcunov at openvz.org
Fri Jan 27 14:23:27 EST 2012


The commit is pushed to "master" and will appear on git://github.com/cyrillos/crtools.git
------>
commit b0e4a2edcd14230db1ea4882a356aa762844bbac
Author: Cyrill Gorcunov <gorcunov at openvz.org>
Date:   Wed Jan 25 20:29:58 2012 +0400

    sockets: Add nr_icons member to track number of icons instead of zero ended array
    
    Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
    Acked-by: Pavel Emelyanov <xemul at parallels.com>
---
 sockets.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/sockets.c b/sockets.c
index 6b10d1b..64ec9f3 100644
--- a/sockets.c
+++ b/sockets.c
@@ -51,6 +51,7 @@ struct unix_sk_desc {
 	unsigned int		wqlen;
 	unsigned int		namelen;
 	char			*name;
+	unsigned int		nr_icons;
 	unsigned int		*icons;
 };
 
@@ -428,12 +429,12 @@ static int unix_collect_one(struct unix_diag_msg *m, struct rtattr **tb)
 	if (tb[UNIX_DIAG_ICONS]) {
 		int len = RTA_PAYLOAD(tb[UNIX_DIAG_ICONS]);
 
-		d->icons = xmalloc(len + sizeof(u32));
+		d->icons = xmalloc(len);
 		if (!d->icons)
 			goto err;
 
 		memcpy(d->icons, RTA_DATA(tb[UNIX_DIAG_ICONS]), len);
-		d->icons[len / sizeof(u32)] = 0;
+		d->nr_icons = len / sizeof(u32);
 	}
 
 	if (tb[UNIX_DIAG_RQLEN]) {


More information about the CRIU mailing list