[14/17] unix: Improve init_unix_sk_info

Submitted by Cyrill Gorcunov on April 27, 2018, 11:35 a.m.

Details

Message ID 20180427113505.20616-15-gorcunov@gmail.com
State Accepted
Series "unix: Add support for ghost unix sockets"
Headers show

Commit Message

Cyrill Gorcunov April 27, 2018, 11:35 a.m.
This helper must init every member of a structure,
not some part of it. Beautify code as well.

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

Patch hide | download patch | download mbox

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;
 }