mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-17 16:47:50 +00:00
cr_page_server(): avoid using uninit variable
In case opts.ps_socket is set (see commit 7058714),
we don't call accept() and so the peer address (caddr)
is left uninitialized, but we try to print it.
Fix by moving the printing code to right after accept().
Reported by Coverity, CID 51645.
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
2403ee4695
commit
1e919423a8
1 changed files with 5 additions and 7 deletions
12
page-xfer.c
12
page-xfer.c
|
|
@ -354,17 +354,15 @@ no_server:
|
|||
ret = ask = accept(sk, (struct sockaddr *)&caddr, &clen);
|
||||
if (ask < 0)
|
||||
pr_perror("Can't accept connection to server");
|
||||
|
||||
else
|
||||
pr_info("Accepted connection from %s:%u\n",
|
||||
inet_ntoa(caddr.sin_addr),
|
||||
(int)ntohs(caddr.sin_port));
|
||||
close(sk);
|
||||
}
|
||||
|
||||
if (ask >= 0) {
|
||||
pr_info("Accepted connection from %s:%u\n",
|
||||
inet_ntoa(caddr.sin_addr),
|
||||
(int)ntohs(caddr.sin_port));
|
||||
|
||||
if (ask >= 0)
|
||||
ret = page_server_serve(ask);
|
||||
}
|
||||
|
||||
if (daemon_mode)
|
||||
exit(ret);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue