[CRIU] [PATCH v5 14/21] unix: Improve init_unix_sk_info

Cyrill Gorcunov gorcunov at gmail.com
Thu May 10 17:57:54 MSK 2018


This helper must init every member of a structure,
not some part of it. Beautify code as well.

Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
 criu/sk-unix.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/criu/sk-unix.c b/criu/sk-unix.c
index b1da3c564f7e..dcd1ba27bb37 100644
--- a/criu/sk-unix.c
+++ b/criu/sk-unix.c
@@ -1807,16 +1807,21 @@ static int init_unix_sk_info(struct unix_sk_info *ui, UnixSkEntry *ue)
 		ui->name = NULL;
 	ui->name_dir = (void *)ue->name_dir;
 
-	ui->queuer = NULL;
-	ui->peer = NULL;
-	ui->bound = 0;
-	ui->listen = 0;
-	ui->is_connected = 0;
+	ui->flags		= 0;
+	ui->peer		= NULL;
+	ui->queuer		= NULL;
+	ui->bound		= 0;
+	ui->listen		= 0;
+	ui->is_connected	= 0;
 	ui->peer_queue_restored = 0;
+
+	memzero(&ui->peer_resolve, sizeof(ui->peer_resolve));
+	memzero(&ui->d, sizeof(ui->d));
+
+	INIT_LIST_HEAD(&ui->list);
 	INIT_LIST_HEAD(&ui->connected);
 	INIT_LIST_HEAD(&ui->node);
 	INIT_LIST_HEAD(&ui->scm_fles);
-	ui->flags = 0;
 
 	return 0;
 }
-- 
2.14.3



More information about the CRIU mailing list