Commit 67e91d65 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

shmem: restore_shmem_content -- Use close_safe

Don't call close() with degative fd. For consistency
simply use close_safe here. All fds touched are initialized
either to valid fd or to value < 0 which pretty good handled
by close_safe helper.

CID 996212 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)
10. negative_returns: "fd" is passed to a parameter that cannot be negative.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent ab0eb45d
...@@ -186,12 +186,12 @@ static int restore_shmem_content(void *addr, struct shmem_info *si) ...@@ -186,12 +186,12 @@ static int restore_shmem_content(void *addr, struct shmem_info *si)
} }
close(fd_pg); close_safe(&fd_pg);
close(fd); close_safe(&fd);
return ret; return ret;
out_close: out_close:
close(fd); close_safe(&fd);
err_unmap: err_unmap:
munmap(addr, si->size); munmap(addr, si->size);
return -1; return -1;
......
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