chiark / gitweb /
util: avoid double close of fd
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Wed, 8 Oct 2014 21:57:32 +0000 (23:57 +0200)
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Wed, 8 Oct 2014 22:19:57 +0000 (00:19 +0200)
commit6f53e671aa7539cab02c9f739d84d28a343ca5bc
tree9a415a8eb71bb30c7b69d29d7905712b5bff6d47
parent5ab99e076c72a44f2e174e48abd9945cd0180d76
util: avoid double close of fd

We could end with a double close if we close the fd loop and flush_fd
fails. That would make us goto fail and there we close the fd once
again. This patch sets the fd to the return value for safe_close: -1
A fd with negative value will be ignored by the next call to
safe_close.

CID#996223
src/shared/util.c