mirror of
https://github.com/ceph/ceph
synced 2024-12-19 01:46:00 +00:00
pidfile: fix fd leak from pidfile_remove()
CID 717081: Resource leak (RESOURCE_LEAK) At (10): Handle variable "fd" going out of scope leaks the handle. Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
parent
687d6d58f1
commit
98da9f9b8c
@ -82,9 +82,9 @@ int pidfile_remove(void)
|
||||
char buf[32];
|
||||
memset(buf, 0, sizeof(buf));
|
||||
ssize_t res = safe_read(fd, buf, sizeof(buf));
|
||||
TEMP_FAILURE_RETRY(::close(fd));
|
||||
if (res < 0)
|
||||
return res;
|
||||
TEMP_FAILURE_RETRY(::close(fd));
|
||||
int a = atoi(buf);
|
||||
if (a != getpid())
|
||||
return -EDOM;
|
||||
|
Loading…
Reference in New Issue
Block a user