Commit 229defc9 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov

Make sure no uninitialized values are used

I've got it if -O2 compilation option used.

 | cr-restore.c:1069:5: error: ‘ret’ may be used uninitialized in this function [-Werror=uninitialized]
 | sockets.c:1145:7: error: ‘sk’ may be used uninitialized in this function [-Werror=uninitialized]

In first case 'ret' indeed might be uninitialized, and
in second case "goto err" was called too early. Fix them both.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent 3876cada
......@@ -943,9 +943,10 @@ static rt_sigaction_t sigchld_act;
static int prepare_sigactions(int pid)
{
rt_sigaction_t act, oact;
int fd_sigact, ret;
int fd_sigact;
struct sa_entry e;
int sig, i;
int ret = -1;
fd_sigact = open_image_ro(CR_FD_SIGACT, pid);
if (fd_sigact < 0)
......
......@@ -1103,12 +1103,12 @@ static int open_inet_sk(struct inet_sk_entry *ie, int *img_fd)
if (ie->family != AF_INET) {
pr_err("Unsupported socket family: %d\n", ie->family);
goto err;
return -1;
}
if (ie->type != SOCK_STREAM) {
pr_err("Unsupported socket type: %d\n", ie->type);
goto err;
return -1;
}
sk = socket(ie->family, ie->type, ie->proto);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment