Commit 69ca9aff authored by Libo Chen's avatar Libo Chen Committed by Pavel Emelyanov

cr-check: fix pipe fd leak

fix fdinfo leak.
Signed-off-by: 's avatarLibo Chen <libo.chen@huawei.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 9c88d0cd
...@@ -379,18 +379,23 @@ static int check_unaligned_vmsplice(void) ...@@ -379,18 +379,23 @@ static int check_unaligned_vmsplice(void)
ret = pipe(p); ret = pipe(p);
if (ret < 0) { if (ret < 0) {
pr_perror("Can't create pipe"); pr_perror("Can't create pipe");
return -1; return ret;
} }
iov.iov_base = &buf; iov.iov_base = &buf;
iov.iov_len = sizeof(buf); iov.iov_len = sizeof(buf);
ret = vmsplice(p[1], &iov, 1, SPLICE_F_GIFT | SPLICE_F_NONBLOCK); ret = vmsplice(p[1], &iov, 1, SPLICE_F_GIFT | SPLICE_F_NONBLOCK);
if (ret < 0) { if (ret < 0) {
pr_perror("Unaligned vmsplice doesn't work"); pr_perror("Unaligned vmsplice doesn't work");
return -1; goto err;
} }
pr_info("Unaligned vmsplice works OK\n"); pr_info("Unaligned vmsplice works OK\n");
return 0; ret = 0;
err:
close(p[0]);
close(p[1]);
return ret;
} }
#ifndef SO_GET_FILTER #ifndef SO_GET_FILTER
......
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