diff options
author | Damian Hobson-Garcia <dhobsong@igel.co.jp> | 2021-04-12 16:43:57 +0900 |
---|---|---|
committer | Damian Hobson-Garcia <dhobsong@igel.co.jp> | 2021-04-12 18:25:24 +0900 |
commit | 43feb8701361e43ef43460ae16b3837e97b174ed (patch) | |
tree | 0e25c5067a4025f384fe517db5cf6565a5942ae9 /libdlmclient | |
parent | bd9df88e70982fb0de81664ebf928d1a414d2887 (diff) |
Don't close invalid or uninitialied fdsmarlin_12.90.0marlin/12.90.0lamprey_11.93.0lamprey_11.92.0lamprey_11.91.0lamprey/11.93.0lamprey/11.92.0lamprey/11.91.0jellyfish_10.0.3jellyfish/10.0.312.90.011.93.011.92.011.91.010.0.3
Avoid calling close() on file descriptors that have not been intialized,
(or initialized to 0) and descriptors that are known to be invalid.
Closing file descriptors due to handle failing initialization is handled
in the intialization code. In the lease-manager, file descriptors can be
invalid during normal operation, so validity is tested at shutdown.
Bug-AGL: SPEC-3862
Change-Id: I798273195cba297c14c6b97d50c7614164fda7df
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
Diffstat (limited to 'libdlmclient')
-rw-r--r-- | libdlmclient/dlmclient.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libdlmclient/dlmclient.c b/libdlmclient/dlmclient.c index dbe2609..af7d3ac 100644 --- a/libdlmclient/dlmclient.c +++ b/libdlmclient/dlmclient.c @@ -120,7 +120,7 @@ struct dlm_lease *dlm_get_lease(const char *name) } if (!lease_send_request(lease, DLM_GET_LEASE)) - goto err; + goto err_request; if (!lease_recv_fd(lease)) goto err; @@ -129,8 +129,11 @@ struct dlm_lease *dlm_get_lease(const char *name) err: saved_errno = errno; - dlm_release_lease(lease); + lease_send_request(lease, DLM_RELEASE_LEASE); errno = saved_errno; +err_request: + close(lease->dlm_server_sock); + free(lease); return NULL; } |