Commit 2543598c authored by Andrei Vagin's avatar Andrei Vagin

criu: don't leak a service fd

Recently, I introduced a new mode when a service fd are not dupped into
a fixed file descriptor number. A side effect of this is that we need to
close the old descritpor if it was installed.

Fixes: d3499999 ("criu: remove all magic of service-fd when it isn't required")
parent a3c47a9f
...@@ -495,6 +495,8 @@ int install_service_fd(enum sfd_type type, int fd) ...@@ -495,6 +495,8 @@ int install_service_fd(enum sfd_type type, int fd)
sfds_protection_bug(type); sfds_protection_bug(type);
if (service_fd_base == 0) { if (service_fd_base == 0) {
if (test_bit(type, sfd_map))
close(sfd_arr[type]);
sfd_arr[type] = fd; sfd_arr[type] = fd;
set_bit(type, sfd_map); set_bit(type, sfd_map);
return fd; return fd;
......
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