Fix file descriptor leak in hstox test.

We return E_WRITE because closing only fails when an I/O error occurs,
which is likely an error from the write() call above. See close(2) for
details.

http://man7.org/linux/man-pages/man2/close.2.html
This commit is contained in:
iphydf 2018-01-10 13:22:07 +00:00
parent 2e33ab26df
commit a3079e82dd
No known key found for this signature in database
GPG Key ID: 3855DBA2D74403C9

View File

@ -89,6 +89,7 @@ static int write_sample_input(msgpack_object req)
msgpack_pack_object(&pk, req); msgpack_pack_object(&pk, req);
check_return(E_WRITE, write(fd, sbuf.data, sbuf.size)); check_return(E_WRITE, write(fd, sbuf.data, sbuf.size));
check_return(E_WRITE, close(fd));
return E_OK; return E_OK;
} }