mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-01 14:55:39 +00:00
sk-inet: fix error handling
Currently do_dump_one_inet_fd returns ret, but this variable is overwritten a few times and it can be zero on error paths. Use a separate variable for the function exit code. By default it is -1 and it is set to zero at the end. It's not changed anywere anywhere except these two places. Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
5b8f179f1b
commit
f9b3dd7ad5
@@ -226,7 +226,7 @@ static int do_dump_one_inet_fd(int lfd, u32 id, const struct fd_parms *p, int fa
|
|||||||
struct inet_sk_desc *sk;
|
struct inet_sk_desc *sk;
|
||||||
InetSkEntry ie = INET_SK_ENTRY__INIT;
|
InetSkEntry ie = INET_SK_ENTRY__INIT;
|
||||||
SkOptsEntry skopts = SK_OPTS_ENTRY__INIT;
|
SkOptsEntry skopts = SK_OPTS_ENTRY__INIT;
|
||||||
int ret = -1;
|
int ret = -1, err = -1;
|
||||||
|
|
||||||
sk = (struct inet_sk_desc *)lookup_socket(p->stat.st_ino, family);
|
sk = (struct inet_sk_desc *)lookup_socket(p->stat.st_ino, family);
|
||||||
if (!sk) {
|
if (!sk) {
|
||||||
@@ -292,17 +292,17 @@ static int do_dump_one_inet_fd(int lfd, u32 id, const struct fd_parms *p, int fa
|
|||||||
|
|
||||||
switch (sk->proto) {
|
switch (sk->proto) {
|
||||||
case IPPROTO_TCP:
|
case IPPROTO_TCP:
|
||||||
ret = dump_one_tcp(lfd, sk);
|
err = dump_one_tcp(lfd, sk);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = 0;
|
err = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
err:
|
err:
|
||||||
release_skopts(&skopts);
|
release_skopts(&skopts);
|
||||||
xfree(ie.src_addr);
|
xfree(ie.src_addr);
|
||||||
xfree(ie.dst_addr);
|
xfree(ie.dst_addr);
|
||||||
return ret;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dump_one_inet_fd(int lfd, u32 id, const struct fd_parms *p)
|
static int dump_one_inet_fd(int lfd, u32 id, const struct fd_parms *p)
|
||||||
|
Reference in New Issue
Block a user